Joy is in the air!
----------------
Choose an integer, say 19. Calculate the sum of the squares of its digits—in this case, 12 + 92 = 82—and repeat! In our example, we next obtain 82 + 22 = 68, then 62 + 82 = 100, and finally 12 + 02 + 02 = 1. Do we always end up at 1? No! You can check that starting with 4 successively gives 16, 37, 58, 89, 145, 42, 20, then... 4 again! Once caught in this cycle, there is no escaping it. These are in fact the only two possible outcomes: either the sequence ends at 1, or it falls into the infernal cycle 4, 16, 37... Numbers for which the process ends at 1 are called happy.
A host of questions immediately arise. We know, for example, that there are infinitely many happy numbers, but their density is unknown. Some mathematicians believe it to be 1/7, but the question remains open; for now, all we know is that it is "not very far" from this value. We can also ask how many steps a happy number takes to reach 1. For example, what is the smallest happy number that reaches 1 in n steps? The answers are known only for small values of n.
In 2006, Hao Pan proved that there are arbitrarily long runs of consecutive happy numbers. The first pair consists of 31 and 32. The first run of three starts at 1,880, the first run of four at 7,839, the first run of five at 44,488, and the first run of six at... 7,899,999,999,999,959,999,999,996. What about unhappy numbers? There is no shortage of questions, but many answers remain elusive!