All about flooble | fun stuff | Get a free chatterbox | Free JavaScript | Avatars    
perplexus dot info

Home > Numbers
Semiprime Names (Posted on 2010-12-06) Difficulty: 3 of 5
Six is a semiprime (the product of two primes). Its name, written in English, has 3 letters and 3 is one of the two primes that produce 6.

What 2-digit semiprime is like that?

What is the smallest such 3-digit semiprime?

What is the smallest such 4-digit semiprime?

Consider two cases for each:

  • Use the word "and" in all numbers such as "one-hundred and one".
  • Don't use the word "and" in those numbers.

In any event, don't use locutions such as "nineteen hundred"; rather, use "one thousand nine hundred" for this example.

  Submitted by Charlie    
No Rating
Solution: (Hide)
The respective sets of numbers that meet the criteria, their names and the prime factors for such numbers under 10,000 are (the first prime factor shown is the number of letters in the name):

 6 SIX   3  2
 33 THIRTY-THREE   11  3
 253 TWO HUNDRED AND FIFTY-THREE   23  11
 299 TWO HUNDRED AND NINETY-NINE   23  13
 667 SIX HUNDRED AND SIXTY-SEVEN   23  29
 713 SEVEN HUNDRED AND THIRTEEN   23  31
 851 EIGHT HUNDRED AND FIFTY-ONE   23  37
 901 NINE HUNDRED AND ONE   17  53
 1007 ONE THOUSAND AND SEVEN   19  53
 1081 ONE THOUSAND AND EIGHTY-ONE   23  47
 3293 THREE THOUSAND TWO HUNDRED AND NINETY-THREE   37  89
 3589 THREE THOUSAND FIVE HUNDRED AND EIGHTY-NINE   37  97
 4009 FOUR THOUSAND AND NINE   19  211
 4309 FOUR THOUSAND THREE HUNDRED AND NINE   31  139
 4847 FOUR THOUSAND EIGHT HUNDRED AND FORTY-SEVEN   37  131
 5587 FIVE THOUSAND FIVE HUNDRED AND EIGHTY-SEVEN   37  151
 5611 FIVE THOUSAND SIX HUNDRED AND ELEVEN   31  181
 6001 SIX THOUSAND AND ONE   17  353
 6049 SIX THOUSAND AND FORTY-NINE   23  263
 7409 SEVEN THOUSAND FOUR HUNDRED AND NINE   31  239


6 SIX   3  2
33 THIRTY-THREE   11  3
551 FIVE HUNDRED FIFTY-ONE   19  29
1147 ONE THOUSAND ONE HUNDRED FORTY-SEVEN   31  37
1271 ONE THOUSAND TWO HUNDRED SEVENTY-ONE   31  41
1643 ONE THOUSAND SIX HUNDRED FORTY-THREE   31  53
1711 ONE THOUSAND SEVEN HUNDRED ELEVEN   29  59
2263 TWO THOUSAND TWO HUNDRED SIXTY-THREE   31  73
2449 TWO THOUSAND FOUR HUNDRED FORTY-NINE   31  79
4681 FOUR THOUSAND SIX HUNDRED EIGHTY-ONE   31  151
6119 SIX THOUSAND ONE HUNDRED NINETEEN   29  211
6641 SIX THOUSAND SIX HUNDRED FORTY-ONE   29  229
8711 EIGHT THOUSAND SEVEN HUNDRED ELEVEN   31  281
8903 EIGHT THOUSAND NINE HUNDRED THREE   29  307

So the answer sets are:
33, 253, 1007
and
33, 551, 1147

DECLARE FUNCTION verify! (s1$, s2$)
DECLARE SUB ProcPiece (piece$, MajorPower!)
DATA one,two,three,four,five,six,seven,eight,nine
DATA ten,eleven,twelve,thirteen,fourteen,fifteen,sixteen,seventeen
DATA eighteen,nineteen
DATA twenty,thirty,forty,fifty,sixty,seventy,eighty,ninety
DATA thousand,million,billion,trillion,quadrillion,quintillion,sextillion
DIM SHARED unit$(19), ten$(10), major$(7)
FOR i = 1 TO 19
  READ unit$(i)
NEXT
FOR i = 2 TO 9
  READ ten$(i)
NEXT
FOR i = 1 TO 7
  READ major$(i)
NEXT
DIM SHARED name$, num$, n
        CLS
        FOR n = 2 TO 9999
          num$ = LTRIM$(RTRIM$(STR$(n)))

          IF num$ = "0" THEN
                  name$ = "zero"
          ELSE
                  name$ = ""
                  MajorPower = 0
                  DO
                          l = LEN(num$): IF l > 3 THEN l = 3
                          piece$ = RIGHT$(num$, l)
                          num$ = LEFT$(num$, LEN(num$) - l)
                          CALL ProcPiece(piece$, MajorPower)
                          MajorPower = MajorPower + 1
                  LOOP WHILE LEN(num$) > 0
          END IF
          name1$ = UCASE$(name$)
          name$ = name1$
          DO
            i = verify(name$, "ABCDEFGHIJKLMNOPQRSTUVWXYZ")
            IF i THEN name$ = LEFT$(name$, i - 1) + MID$(name$, i + 1)
          LOOP UNTIL i = 0
          l = LEN(name$)
          IF n MOD l = 0 THEN
           pr = 1
           FOR i = 2 TO SQR(l)
             IF l MOD i = 0 THEN pr = 0: EXIT FOR
           NEXT i
           IF pr THEN
            n2 = n \ l
            FOR i = 2 TO SQR(n2)
              IF n2 MOD i = 0 THEN pr = 0: EXIT FOR
            NEXT i
            IF pr THEN
             PRINT n; name1$; l; n2
            END IF
           END IF
          END IF
        NEXT


SUB ProcPiece (piece$, MajorPower)
  piece = VAL(piece$)
  n$ = ""
  IF piece > 99 THEN
    n$ = unit$(piece \ 100) + " hundred "
    piece = piece MOD 100
    IF piece > 0 THEN n$ = n$ + "and " 
                           ' this to be commented out for part 2
  ELSE
    IF MajorPower = 0 AND n > 999 THEN n$ = n$ + "and "
                           ' likewise this
  END IF
  IF piece > 19 THEN
    n$ = n$ + ten$(piece \ 10)
    piece = piece MOD 10
    IF piece > 0 THEN n$ = n$ + "-":  ELSE n$ = n$ + " "
  END IF
  IF piece > 0 THEN n$ = n$ + unit$(piece) + " "
  IF n$ > "" THEN name$ = n$ + major$(MajorPower) + " " + name$
END SUB

FUNCTION verify (s1$, s2$)
  FOR i = 1 TO LEN(s1$)
    IF INSTR(s2$, MID$(s1$, i, 1)) = 0 THEN verify = i: EXIT FUNCTION
  NEXT
  verify = 0
END FUNCTION

Based upon Enigma No. 1614, "Letters & products", by Richard England, New Scientist, 25 September 2010.

Comments: ( You must be logged in to post comments.)
  Subject Author Date
solutionDej Mar2010-12-07 06:30:47
Some Thoughts1st couple -partial spoilerAdy TZIDON2010-12-06 14:46:21
Please log in:
Login:
Password:
Remember me:
Sign up! | Forgot password


Search:
Search body:
Forums (0)
Newest Problems
Random Problem
FAQ | About This Site
Site Statistics
New Comments (1)
Unsolved Problems
Top Rated Problems
This month's top
Most Commented On

Chatterbox:
Copyright © 2002 - 2017 by Animus Pactum Consulting. All rights reserved. Privacy Information