Happy Number - Sequence Behavior

Sequence Behavior

If n is not happy, then its sequence does not go to 1. What happens instead is that it ends up in the cycle

4, 16, 37, 58, 89, 145, 42, 20, 4, ...

To see this fact, first note that if n has m digits, then the sum of the squares of its digits is at most, or .

For and above,

so any number over 1000 gets smaller under this process and in particular becomes a number with strictly fewer digits. Once we are under 1000, the number for which the sum of squares of digits is largest is 999, and the result is 3 times 81, that is, 243.

  • In the range 100 to 243, the number 199 produces the largest next value, of 163.
  • In the range 100 to 163, the number 159 produces the largest next value, of 107.
  • In the range 100 to 107, the number 107 produces the largest next value, of 50.

Considering more precisely the intervals, and, we see that every number above 99 gets strictly smaller under this process. Thus, no matter what number we start with, we eventually drop below 100. An exhaustive search then shows that every number in the interval either is happy or goes to the above cycle.

The above work produces the interesting result that no positive integer other than 1 is the sum of the squares of its own digits, since any such number would be a fixed point of the described process.

There are infinitely many happy numbers and infinitely many unhappy numbers. As an informal proof, consider the following:

  • For any happy number, every number in its sequence is happy. Likewise for unhappy numbers.
  • For this reason, to come up with a new happy number, it is sufficient to find a number such that the sum of the squares of its digits is itself a happy number. Likewise, to find a new unhappy number, one can simply find a number such that the sum of the squares of its digits leads to an unhappy number.
  • It is easy to generate a number that leads (in this sequence) to a known happy or unhappy number. For example, if one wonders if any number will produce 14,308, say, the quick response is to write down the digit "1" 14,308 times and you have created such a number.
  • Infinitely many such numbers exist, since zeros can be inserted at will.

The first pair of consecutive happy numbers is 31, 32. The first set of triplets is 1880, 1881, and 1882.

An interesting question is to wonder about the density of happy numbers. In the interval, 15.5% (to three significant figures) are happy.(sequence A068571 in OEIS)

Read more about this topic:  Happy Number

Famous quotes containing the words sequence and/or behavior:

    It isn’t that you subordinate your ideas to the force of the facts in autobiography but that you construct a sequence of stories to bind up the facts with a persuasive hypothesis that unravels your history’s meaning.
    Philip Roth (b. 1933)

    To be told that our child’s behavior is “normal” offers little solace when our feelings are badly hurt, or when we worry that his actions are harmful at the moment or may be injurious to his future. It does not help me as a parent nor lessen my worries when my child drives carelessly, even dangerously, if I am told that this is “normal” behavior for children of his age. I’d much prefer him to deviate from the norm and be a cautious driver!
    Bruno Bettelheim (20th century)