All about flooble | fun stuff | Get a free chatterbox | Free JavaScript | Avatars
 perplexus dot info

 Some cubes! (Posted on 2012-08-10)
LIST all the integers equal to the sum of the digits of their cubes.
Prove that your list is exhaustive.

 No Solution Yet Submitted by Ady TZIDON No Rating

Comments: ( Back to comment list | You must be logged in to post comments.)
 computer solution | Comment 2 of 8 |

DECLARE FUNCTION sod# (n#)
DEFDBL A-Z
FOR n = 0 TO 99
s = sod(n * n * n)
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
8
17
18
26
27

The largest 3-digit number has a 9-digit cube and a 9-digit number can have a sod of at most 9*6=54, which has only two digits; other cubes of 3-digit numbers are even smaller. The largest 4-digit number has 12 digits and their largest sod, even in theory, can only be 9*12=108, a 3-digit number. This continues, so that n can have no more than two digits and the above program tests all 2-digit numbers, so that the list is complete.

`# of digits   largest # of digits of sod(cube)   (n)         (ceil(log(n*3*9)))`
`1                      22                      23                      24                      35                      36                      3         ...19                     320                     337                     338                     4`

 Posted by Charlie on 2012-08-10 12:21:18

 Search: Search body:
Forums (0)