Fish Cubes

Here's an interesting number game for you to try when you have a few spare minutes (and a calculator!):

1) Think of a number, any number, pick one at random. Can be as big or small as you like.

2) Multiply this number by 3

3) Split the number into its digits (e.g. 27 would give you 2 and 7)

4) Calculate the cube of each of these digits (the "cube" is calculated by multiplying the number by itself three times. e.g. 2 cubed = 2x2x2 = 8. 7 cubed = 7x7x7 = 343)

5) Add the cubes together to form a new number

6) Repeat steps 3->5; splitting the number into its digits, and summing the cubes. Stop when the number doesn't change.

What do you get? Post your answer in the comments.


Ricky Carvel said...

The clue was in the subject line of your previous post... of course I get 153.

Presumably 153 is the only number where the sum of the cubes of each of the digits is itself. But 135, 315, 351, 513 ans 531 also all give 153, so you spin round the loop enough times until you hit one of those numbers.

I wonder why you have to multiply by three first?

The first time I tried this I misread your instructions and included the 'multiply by 3' stage at each iteration. Eventually you hit on a recurring pair of 99 giving 1080 and 1080 giving 99 if you do that.

I didn't waste too much time on this though - I used Excel :o)

Chris HH said...

Well done, Ricky!
Bonus points for using Excel. (I used Perl myself to check it worked)

153 is not the only number that is the sum of the cube of its digits; 370 and 371 also fit the bill. But it is the smallest.

It is not inevitable that all numbers should converge on 153, but for some reason (I don't claim to understand) all numbers divisible by three do.

Pick any number and multiply by three is easier than saying pick a number divisible by three! ;-)

Chris HH said...

Having thought about this a bit more, it's fairly easy to prove that all numbers that meet this criteria must have four digits or fewer.

The biggest number that can be generated from a n-digit number by summing the cubes is n x 729 (where all the digits are nines)

The smallest number that an n-digit number can be is 10^n-1. 10 for 2, 100 for 3 etc.

So for there to be any possibility of an n-digit number being the sum of its own digits cubed, the following condition must be true: 729*n > 10^n-1. This only works for values of n between 1 and 4.

Knowing this, that there are only 9999 possible numbers to check, and a bit of programming skill leads to the following discovery: there are only 4 such numbers in existence (excluding 1!)


How's that for a bit of Friday trivia? ;-)