There exists a number oddity with 3 different 4digit numbers. One is 9801, where (98 + 01)^2 = 9801. It also works with 3025: (30+25)^2 = 3025.
What is the other number?
What is the smallest 6digit number that would work?
(in other words, in a 6digit number abcdef: abcdef=(abc+def)^2)
The program:
DEFDBL AZ
CLS
FOR n = 1000 TO 9999
n$ = RIGHT$(LTRIM$(STR$(n)), 4)
a$ = LEFT$(n$, 2)
b$ = RIGHT$(n$, 2)
t = VAL(a$) + VAL(b$)
IF t * t = n THEN PRINT n
NEXT
FOR n = 100000 TO 999999
n$ = RIGHT$(LTRIM$(STR$(n)), 6)
a$ = LEFT$(n$, 3)
b$ = RIGHT$(n$, 3)
t = VAL(a$) + VAL(b$)
IF t * t = n THEN PRINT n
NEXT
finds
2025
3025
9801
494209
998001

Posted by Charlie
on 20040403 10:34:56 