# What are "Happy Numbers" and "Unhappy Numbers?"

In recreational mathematics, the so-called "happy numbers" and "unhappy numbers" are integers that produce particular sequences when you repeatedly square the number's digits and compute the sum of those squares.

One of two outcomes can occur when you apply this summation process over and over: (i) the sum will stabilize at 1, or (ii) the sum will stabilize in a loop that repeats forever.

Integers that stabilize at 1 are called "happy numbers" and integers that fall into the loop are called "unhappy numbers."

We explain how to determine whether an integer is happy or unhappy with examples below. You can also use the happy number checker on the left. Learning about square numbers and sequences through the happy integers can be a fun project for elementary school children.

### Example 1: A Happy Number

The number 67121 is a happy number because its summation sequence stabilizes at 1. Observe:67121 ---- 6

^{2}+ 7

^{2}+ 1

^{2}+ 2

^{2}+ 1

^{2}= 36 + 49 + 1 + 4 + 1 = 91

91 -------- 9

^{2}+ 1

^{2}= 81 + 1 = 82

82 -------- 8

^{2}+ 2

^{2}= 64 + 4 = 68

68 -------- 6

^{2}+ 8

^{2}= 36 + 64 = 100

100 ------ 1

^{2}+ 0

^{2}+ 0

^{2}= 1 + 0 + 0 = 1

1 --------- 1

^{2}= 1

1 --------- 1

^{2}= 1...

All of the happy numbers less than 200 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, and 193.

If a number is happy, then you can generate another happy number just by rearranging the digits and inserting 0's. For instance, since we determined that 67121 is happy, it implies that 72116, 1102076, 702611, etc are also happy numbers.

### Example 2: An Unhappy Number

If a number's summation sequence does not stabilize at 1, then it stabilizes in this loop of 8 numbers:...4 -- 16 --

**37**--

**58**--

**89**--

**145**--

**42**--

**20**--

**4**--

**16**-- 37 -- 58...

For example, if we start with the number 34782, we will eventually repeate the cycle of numbers above. Watch:

34782 ---- 3

^{2}+ 4

^{2}+ 7

^{2}+ 8

^{2}+ 2

^{2}= 9 + 16 + 49 + 64 + 4 = 142

142 ------- 1

^{2}+ 4

^{2}+ 2

^{2}= 1 + 16 + 4 = 21

21 -------- 2

^{2}+ 1

^{2}= 4 + 1 = 5

5 ---------- 5

^{2}= 25

25 -------- 2

^{2}+ 5

^{2}= 4 + 25 = 29

29 -------- 2

^{2}+ 9

^{2}= 4 + 81 = 85

85 -------- 8

^{2}+ 5

^{2}= 64 + 25 = 89

89 -------- 8

^{2}+ 9

^{2}= 64 + 81 = 145

145 ------ 1

^{2}+ 4

^{2}+ 5

^{2}= 1 + 16 + 25 = 42

42 -------- 4

^{2}+ 2

^{2}= 16 + 4 = 20

20 -------- 2

^{2}+ 0

^{2}= 4 + 0 = 4

4 --------- 4

^{2}= 16

16 -------- 1

^{2}+ 6

^{2}= 1 + 36 = 37

37 -------- 3

^{2}+ 7

^{2}= 9 + 49 = 58

58 -------- 5

^{2}+ 8

^{2}= 25 + 64 = 89

89 -------- 8

^{2}+ 9

^{2}= 64 + 81 = 145...

You can generalize the concept of happy/unhappy numbers by replacing the squaring operation with a different operation. In particular, if you cube the numbers instead of squaring them, you get more interesting behavior as explained below.

### Happy Cube Numbers

If you cube the digits of the number, add the cubes, and then repeat the process with the rusulting number, you will also generate a stable pattern that repeats indefinitely. If the process stabilizes at 1, you have a happy cube number. Otherwise, it will stabilize at one of the following eight cycles, in which case you have an unhappy cube number....

**55**--

**250**--

**133**-- 55 -- 250 -- 133... (3-cycle)

...

**160**--

**217**--

**352**-- 160 -- 217 -- 352... (3-cycle)

...

**136**--

**244**-- 136 -- 244... (2-cycle)

...

**919**--

**1459**-- 919 -- 1459... (2-cycle)

...

**153**-- 153 -- 153... (1-cycle)

...

**370**-- 370 -- 370... (1-cycle)

...

**371**-- 371 -- 371... (1-cycle)

...

**407**-- 407 -- 407... (1-cycle)

**Example:**The number 1234 is a happy cube number. Observe:

1234 -------- 1

^{3}+ 2

^{3}+ 3

^{3}+ 4

^{3}= 1 + 8 + 27 + 64 = 100

100 --------- 1

^{3}+ 0

^{3}+ 0

^{3}= 1 + 0 + 0 = 1

1 ------------ 1

^{2}= 1

1 ------------ 1

^{2}= 1...

© *Had2Know 2010
*