Friday 14 September 2012

Chains of Sums of Squares of Digits




I've always been fascinated by things like the Kaprekar Numbers and the orbits and absorbing states of number operations that seem to border on the edge of chaos and fractals.
Thinking along those lines this morning I decided to explore what happens when you sum the squares of the digits of a number, and then iterate that process on the results.

After a little while I convinced myself that the process would be bounded (no three digit number produces a number larger than three digits for example, in fact no number less than twelve digits would exceed 1000  on the first step of this process). This would force there to be either cycles or absorbing numbers, but would there be one, or many, and what kind of cycles would be generated, if any.

It didn't take long to figure out that one would be an absorbing state for any number that had a single unit and the rest zeros, 1, 10, 100 would all be absorbed by one; but also numbers like 7, 13, 31 70, 103, 130, 301, 700 and all permutations of the numbers that were absorbed more. Were there more? Yes 19 ,23, 28, 68, 44, 49, and of course 94, 91, 82, 32 and 68 would also be absorbed into one.


Other numbers jumped into a cycle that included four:
4 --- 16 --- 37--- 58 --- 89 --- 145 --- 42 --- 20 --- 4

Five took a few steps to find the cycle, then jumps in at 89:

5 --- 25 --- 29 --- 85 --- 89 --- 145 --- .... 4

6 found it's way to fifty, and then twenty-five and joined five's path to the same cycle: 6 --- 36 --- 45 --- 41 --- 17 --- 50 --- 25 ...... 4.

But 7 quickly found it's way to one via, 7 --- 49 --- 97 --- 130 --- 10 --- 1
Now I wondered if this were the fate of all numbers, to proceed along a path to either the cycle which contained four, or the absorption of one.

I begin hoping for exceptions, but found none below 1000. And that would mean that any number up to 1,000,000,000,000 would, go to a number less than 1000, and subsequently to either the absorbing one, or the cycle through four.

I couldn't find any thing about this sequence on line so I can't give any previous history before my little experiment. Perhaps I've stumbled across a new item. Anyway, Enjoy.

Addendum: David Brooks was kind enough to write me and inform me that those numbers which are absorbed by one are called "Happy Numbers", and they actually have an in-depth page on them about Wikipedia.

It includes :
The happy numbers below 500 are:

1, 7, 10, 13, 19, 23, 28, 31, 32, 44, 49, 68, 70, 79, 82, 86, 91, 94, 97, 100, 103, 109, 129, 130, 133, 139, 167, 176, 188, 190, 192, 193, 203, 208, 219, 226, 230, 236, 239, 262, 263, 280, 291, 293, 301, 302, 310, 313, 319, 320, 326, 329, 331, 338, 356, 362, 365, 367, 368, 376, 379, 383, 386, 391, 392, 397, 404, 409, 440, 446, 464, 469, 478, 487, 490, 496 (sequence A007770 in OEIS).

A happy prime is a number that is both happy and prime. The happy primes below 500 are

7, 13, 19, 23, 31, 79, 97, 103, 109, 139, 167, 193, 239, 263, 293, 313, 331, 367, 379, 383, 397, 409, 487 (sequence A035497 in OEIS).


As of 2010, the largest known happy prime is 2^{42643801}-1 (Mersenne prime). Its decimal expansion has 12,837,064 digits.

There are even Happy Pythagorean Triples, with all side lengths that are happy numbers. One is (700, 3465, 3535).

A Similar approach may be used with the sum of cubes of the digits, and there are also absorbing ones, as well as other absorbing states, but also a larger collection of cycling states possible.

Regarding the History, it seems little is known. Happy numbers were brought to the attention of Reg Allenby (a British author and Senior Lecturer in pure mathematics at Leeds University) by his daughter, who had learned of them at school. However, they "may have originated in Russia" according to Richard Guy in Unsolved Problems in Number Theory (3rd ed.)(Perhaps they should be called "счастливые номера")

The numbers have, it appears wove themselves into the mathematical/scientific underground (without my apparent notice) and in the 2007 Doctor Who episode "42", a sequence of happy primes (313, 331, 367, 379) is used as a code for unlocking a sealed door on a spaceship about to collide with a sun. When the Doctor learns that nobody on the spaceship besides himself has heard of happy numbers, he asks, "Don't they teach recreational mathematics anymore?"
Also, the contestants in the 2012 University Challenge final were asked to identify a sequence of numbers as happy primes in a picture round. (Ahh Jeremy Paxman you would have stumped me.)

So Thanks to David, and so many people who have stumbled across this before me.

1 comment:

Unknown said...

Great minds must think alike! Great article