There are three six-digit numbers such that each is a 4th power of its sum of digits .
1. List them.
2. Each one has a certain peculiarity (or more than one). Try to define it.
3. Ignoring the 6-digits constraint , how many integers like that exist?
DECLARE FUNCTION sod# (n#)
DEFDBL A-Z
FOR n = 0 TO 26873856 ' (8*9)^4
s = sod(n)
s = s * s * s * s
IF s = n THEN PRINT n
NEXT n
FUNCTION sod (n)
st$ = LTRIM$(STR$(n))
t = 0
FOR i = 1 TO LEN(st$)
t = t + VAL(MID$(st$, i, 1))
NEXT
sod = t
END FUNCTION
finds
0
1
2401
234256
390625
614656
1679616
By inspection you can see the three 6-digit solutions.
There can't be any more as the largest sod for an 8-digit number is 8*9; when raised to the 4th power, it's 26873856. Then (9*9)^4 and (10*9 )^4 are also only 8-digit numbers so no 9- or 10-digit number will work, nor any larger number as the number of digits in the power will always be smaller than the number of digits in the original number.
|
Posted by Charlie
on 2012-08-14 15:24:35 |