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

Home > Numbers
Some cubes! (Posted on 2012-08-10) Difficulty: 2 of 5
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.)
Solution 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                      2
2                      2
3                      2
4                      3
5                      3
6                      3
         ...
19                     3
20                     3
37                     3
38                     4

  Posted by Charlie on 2012-08-10 12:21:18
Please log in:
Login:
Password:
Remember me:
Sign up! | Forgot password


Search:
Search body:
Forums (0)
Newest Problems
Random Problem
FAQ | About This Site
Site Statistics
New Comments (15)
Unsolved Problems
Top Rated Problems
This month's top
Most Commented On

Chatterbox:
Copyright © 2002 - 2024 by Animus Pactum Consulting. All rights reserved. Privacy Information