Advanced | Help | Encyclopedia
Directory


Happy number

Consider the following process: given a number, take the sum of the squares of its digits. A number is a happy number if iterating this process eventually yields 1. Numbers that are not happy are called unhappy numbers.

More formally, given a number <math>n=n_0<math>, define a sequence <math>n_1<math>, <math>n_2<math>, ... where <math>n_{i+1}<math> is the sum of the squares of the digits of <math>n_i<math>. Then <math>n<math> is happy if and only if this sequence goes to 1.

For example, 7 is happy, as the associated sequence is:

72 = 49
42 + 92 = 97
92 + 72 = 130
12 + 32 + 02 = 10
12 + 02 = 1

If a number is happy, then all members of its sequence are happy; if a number is unhappy, all members of its sequence are unhappy.

The first few happy numbers 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. (sequence A007770 in OEIS)

A computer search up to 1010 suggests that about 15 percent of numbers are happy, though no proof is known.

Sequence behavior

If <math>n<math> 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 <math>n<math> has <math>m<math> digits, then the sum of the squares of its digits is at most <math>81m<math>. If <math>m>3<math> then

<math>n\geq10^{m-1}>81m<math>

so any number over 1000 gets smaller under this process. 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.

We see that every number above 99 gets smaller under this process. Thus, no matter what number you start with, you eventually drop below 100. A computer program can easily verify that in the range 1 to 99, every number is either happy, or goes to the above cycle.

References








Links: Addme | Keyword Research | Paid Inclusion | Femail | Software | Completive Intelligence

Add URL | About Slider | FREE Slider Toolbar - Simply Amazing
Copyright © 2000-2008 Slider.com. All rights reserved.
Content is distributed under the GNU Free Documentation License.