A number and its square both have the same last three digits. What are the possibilities for those digits?
(In reply to
No, a fuller List [part spoiler?] by Vernon Lewis)
FOR i = 0 TO 999
sq = i * i
d1$ = RIGHT$("000" + LTRIM$(STR$(i)), 3)
d$ = RIGHT$("000" + LTRIM$(STR$(sq)), 3)
s$ = d$
good = 1
FOR j = 1 TO 3
ix = INSTR(s$, MID$(d1$, j, 1))
IF ix = 0 THEN
good = 0
EXIT FOR
ELSE
s$ = LEFT$(s$, ix - 1) + MID$(s$, ix + 1)
END IF
NEXT
IF good THEN
PRINT d1$, d$
END IF
NEXT
i i^2 mod 1000
000 000
001 001
010 100
050 500
060 600
205 025
376 376
421 241
625 625
963 369
|
Posted by Charlie
on 2007-08-28 22:29:38 |