Question 1 has several interpretations, so the answers fall into different categories:
1. 0
This answer indeed has zero letters--only a digit.
2. Four.
This answer indeed has four letters.
3. The answer is 11.
The totality of this answer, as a sentence indeed has 11 letters.
4. Wording similar to option 3, but somewhat different, with various numbers being correct depending on how many letters there are in the verbiage, such as "The answer has 19 letters."
5. The answer has twenty-nine letters.
This is also extensible with various wordings, and it ties into the subsequent questions on the list, as here we needed a number name that had a value 19 more than the number of letters in that number name. Again, variations are such as "The answer is nineteen."
Question 2 again has variations.
1. 1
2. Five.
3. The answer is 12.
4. Variations in wording on 3.
5. The answer is twenty-one, and its variations in verbiage.
Question 3 has the usual variations as above, including the one that is unique to it: "seven".
In answering question 4, let's first consider this straightforward single-word-number-oriented intepretation (four, five, seven, ...). There is no similar answer like this for n=4. That's because there are two answers for n=3 ("six" and "eight") and three such answers for n=5 ("nine", "eleven" and "thirteen"). While n can increase in general with the numbers, there are some that are repeated while others do not appear, and the first of these is n=4.
Of course nothing precludes something like "That's 9." or "It's ten." as answers for n=4, and similar verbiages that can be used as work-arounds for any value of n.
Of use in coming up with such answers is a table, ordered by the difference between the signification and the length, of the number words. The following table shows that difference, the signified number, the length of the number name and the name itself:
0 4 4 four
1 5 4 five
2 7 5 seven
3 6 3 six
3 8 5 eight
5 9 4 nine
5 11 6 eleven
5 13 8 thirteen
6 12 6 twelve
6 14 8 fourteen
7 10 3 ten
8 15 7 fifteen
8 17 9 seventeen
9 16 7 sixteen
10 18 8 eighteen
11 19 8 nineteen
12 21 9 twenty-one
12 23 11 twenty-three
13 22 9 twenty-two
14 20 6 twenty
14 24 10 twenty-four
15 25 10 twenty-five
16 27 11 twenty-seven
17 26 9 twenty-six
17 28 11 twenty-eight
19 29 10 twenty-nine
22 31 9 thirty-one
22 33 11 thirty-three
23 32 9 thirty-two
24 30 6 thirty
24 34 10 thirty-four
25 35 10 thirty-five
26 37 11 thirty-seven
27 36 9 thirty-six
27 38 11 thirty-eight
29 39 10 thirty-nine
33 41 8 forty-one
33 43 10 forty-three
34 42 8 forty-two
35 40 5 forty
35 44 9 forty-four
36 45 9 forty-five
37 47 10 forty-seven
38 46 8 forty-six
38 48 10 forty-eight
--------
This table was produced by a computer program whose output was then sorted by the first column. Three negative values were discarded (-1 for "two" and -2 for "one" and "three").
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$
OPEN "reptqest.txt" FOR OUTPUT AS #1
FOR n = 1 TO 100
num$ = LTRIM$(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
numLets = 0
FOR i = 1 TO LEN(name$)
IF INSTR("abcdefghijklmnopqrstuvwxyz", LCASE$(MID$(name$, i, 1))) > 0 THEN
numLets = numLets + 1
END IF
NEXT
PRINT #1, USING "### ### ### &"; n - numLets; n; numLets; name$
NEXT
CLOSE
SUB ProcPiece (piece$, MajorPower)
piece = VAL(piece$)
n$ = ""
IF piece > 99 THEN
n$ = unit$(piece \ 100) + " hundred "
piece = piece MOD 100
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
|
Posted by Charlie
on 2003-09-10 16:04:20 |