The answer is 693 = 3*7*3*11
DEFDBL A-Z
DIM unit$(1 TO 9), teen$(10 TO 19), ten$(2 TO 9)
DATA one,two,three,four,five,six,seven,eight,nine
DATA ten,eleven,twelve,thirteen,fourteen,fifteen,sixteen,seventeen,eighteen,nineteen
DATA twenty,thirty,forty,fifty,sixty,seventy,eighty,ninety
FOR i = 1 TO 9: READ unit$(i): PRINT unit$(i); " "; : NEXT: PRINT
FOR i = 10 TO 19: READ teen$(i): PRINT teen$(i); " "; : NEXT: PRINT
FOR i = 2 TO 9: READ ten$(i): PRINT ten$(i); " "; : NEXT: PRINT
FOR n = 101 TO 999
hundreds = n \ 100
rest = n MOD 100
IF rest > 0 THEN
w1 = LEN(unit$(hundreds))
w2 = LEN("hundred")
w3 = LEN("and")
IF rest < 10 THEN
w4 = LEN(unit$(rest))
ELSEIF rest < 20 THEN
w4 = LEN(teen$(rest))
ELSE
tens = rest \ 10: units = rest MOD 10
w4 = LEN(ten$(tens))
IF units > 0 THEN w4 = w4 + LEN(unit$(units))
END IF
v = w1 * w2 * w3 * w4
END IF
IF n = v THEN PRINT n
NEXT
Based on Enigma No. 1590 "Return to starter" by Richard England, New Scientist, 10 April 2010, page 24. |