1.Take a random positive integer, divisible by three.
2.Consider its base 10 digits.
3.Take the sum of their cubes.
4.Go back to step 2.
Rem: You may limit your research for n<1000.
See The Solution | Submitted by Ady TZIDON |
No Rating |
re(2): non-analytic solution |
|
You're right, of course. 13 is the maximum number of iterations needed
to reach 153 when starting with a number < 10000.
I ended up using 14 because originally, I had used the range 1..10000 instead of 1..3334 not realizing I was actually testing from 1 to 30K because of the factor of three in the method call. Not wrong, but more work than necessary. As it turns out, there are 84 numbers in the range [10000,30000] that require that 14th iteration, starting with 12558.
Before posting, I optimized the range so I only had to check 1/3 as many numbers, but I didn't recheck the upper bound needed to guarantee reaching 153 and so my note, which had been true when I was testing to 30,000, was no longer correct.
Posted by Paul on 2015-09-18 10:00:19 |