The fourth root of the lowest possible 7-digit number,1023456, is 31.8..., so the lowest N to try would be 32. The highest would be 56 ([4th root of 9876543]}. By happenstance, the lowest, 32, raised to the fourth power is 1048576, meeting the conditions of the problem.
The following program verifies not only that the answer is unique as posed, but also that no full-palindrome fourth power of an integer exists (all 10 digits accounted for).
DEFDBL A-Z
FOR n = 1 TO 100
ns$ = LTRIM$(STR$(n))
n4s$ = LTRIM$(STR$(n * n * n * n))
t$ = ns$ + n4s$
IF LEN(t$) = 9 OR LEN(t$) = 10 THEN
good = 1
FOR i = 1 TO LEN(t$) - 1
IF INSTR(i + 1, t$, MID$(t$, i, 1)) > 0 THEN good = 0: EXIT FOR
NEXT
IF good THEN PRINT n; n4s$
END IF
NEXT
|
Posted by Charlie
on 2008-11-01 19:21:28 |