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 |
non-analytic solution |
|
Note that if the number of digits is five or more, then the sum of the cubes of those digits has fewer digits than before. So necessarily, any sequence that starts with a number >= 10000 will include at least one number < 10000.
The following ruby code returns a list of all of the unique values resulting from each starting point < 10000 and iterating no more than 14 times:
def iterated_sum_of_digits_cubed(num)
14.times do
num = num.to_s.split('').reduce(0){|tot,k| tot += k.to_i**3}
end
num
end
(1..3334).map{|x| iterated_sum_of_digits_cubed(3*x) }.uniq
It returns the list: [153]
Since every sequence starting with a number < 10000 ends with 153, and since ever sequence starting with a number >= 10000 contains a subsequence starting with such a number, then all sequences end with 153.
Note: the value 14 was determined empirically; at least one starting number doesn't make it to 153 until the 14th iteration. The value 3334 is the smallest number such that triple it is > 10000
The following ruby code returns a list of all of the unique values resulting from each starting point < 10000 and iterating no more than 14 times:
def iterated_sum_of_digits_cubed(num)
14.times do
num = num.to_s.split('').reduce(0){|tot,k| tot += k.to_i**3}
end
num
end
(1..3334).map{|x| iterated_sum_of_digits_cubed(3*x) }.uniq
It returns the list: [153]
Since every sequence starting with a number < 10000 ends with 153, and since ever sequence starting with a number >= 10000 contains a subsequence starting with such a number, then all sequences end with 153.
Note: the value 14 was determined empirically; at least one starting number doesn't make it to 153 until the 14th iteration. The value 3334 is the smallest number such that triple it is > 10000
Posted by Paul on 2015-09-17 14:53:14 |