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

 Define number n in n letters (Posted on 2018-06-08)
4 is represented by 4 letters: four
20 may be represented by 20 letters: nineteen and two halves
35 by 35 - letters: square root of twelve hundred twenty five

Find more such self-defining expressions.
No restrictions!

 No Solution Yet Submitted by Ady TZIDON No Rating

Comments: ( Back to comment list | You must be logged in to post comments.)
 very limited computer finding | Comment 2 of 4 |
square root of nine hundred sixty-one = 31
square root of one thousand eighty-nine = 33

DECLARE SUB EnterNum ()
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
DIM SHARED unit\$(19), ten\$(10), major\$(7)
FOR i = 1 TO 19
NEXT
FOR i = 2 TO 9
NEXT
FOR i = 1 TO 7
NEXT
DIM SHARED name\$, num\$
FOR sr = 15 TO 1000000
num\$ = LTRIM\$(STR\$(sr * sr))
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
'PRINT name\$
'DO: a\$ = INKEY\$: LOOP WHILE a\$ = ""
tot = 0
FOR i = 1 TO LEN(name\$)
IF INSTR("abcdefghijklmnopqrstuvwxyz", MID\$(name\$, i, 1)) > 0 THEN tot = tot + 1
NEXT
IF 15 + tot = sr THEN PRINT 15, sr, sr * sr, tot, name\$
IF 12 + tot = sr THEN PRINT 12, sr, sr * sr, tot, name\$
a\$ = INKEY\$: IF a\$ = CHR\$(27) THEN EXIT FOR
NEXT sr

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 2018-06-08 21:21:36

 Search: Search body:
Forums (0)