“The Square Root of Wonderful” was the name of play on Broadway.
If each letter in WONDERFUL stands for a different digit (zero excluded) and if OODDF, using the same code, represents the square root, then what is the square root of WONDERFUL?
FOR o = 1 TO 9
FOR d = 0 TO 9
IF d <> o THEN
FOR f = 0 TO 9
IF f <> o AND f <> d THEN
ooddf = o * 11000 + d * 110 + f
wonderful = ooddf * ooddf
o2 = INT(wonderful / 10000000) MOD 10
d2 = INT(wonderful / 100000) MOD 10
f2 = INT(wonderful / 100) MOD 10
IF o2 = o AND d2 = d AND f2 = f THEN
PRINT ooddf, wonderful
No other numbers printed out and this one has unique digits for wonderful, so 22887 is the square root of wonderful.
Posted by Charlie
on 2009-06-07 16:25:10