Happy and Unhappy Numbers

A number (positive integer) is called a happy number when it is replaced by the sum of the squares of its digits on a repeated basis until the sum of the squares of its digits equals to 1. The numbers for which the process of summing up of the squares of its digits ends in 1 are happy numbers. On the other hand, numbers that don’t end in 1 are called unhappy or sad numbers.

Let’s look at the examples below to understand the concept behind it better.

Example 1:- 23 is a happy number. Let’s see how.

23 = 22 + 32 = 4 + 9 = 13 (sum of the squares of its digits)

13 = 12 + 32 = 1 + 9 = 10 (sum of the squares of the digits)

10 = 12 + 02 = 1 (sum of the squares of the digits)

In the above example, we noticed that, when the number 23 is replaced by the sum of the squares of its digits repeatedly, it ends in 1. Therefore, 23 is a happy number.

Example 2:- 36 is an unhappy number. Let’s see how. 36 = 32 + 62 = 9 + 36 = 45

45 = 42 + 52 = 16 + 25 = 41

41 = 42 + 12 = 16 + 1 = 17

17 = 12 + 72 = 1 + 49 =50

50 = 52 + 02 = 25 + 0 = 25

25 = 22 + 52 = 4 + 25 = 29

29 = 22 + 92 = 4 + 81 = 85

85 = 82 + 52 = 64 + 25 = 89

89 = 8 + 9 = 64 + 81 = 145

145 = 1 + 4 + 5 = 1 + 16 + 25 = 42

42 = 4 + 2 = 16 + 4 = 20

20 = 2 + 0 = 4 + 0 = 4

Here, the number 36 loops endlessly in a cycle which doesn’t end in 1. Therefore 36 is an unhappy or sad number.

Properties of Happy and unhappy numbers:-

  1. If a number is happy, then all the numbers in its sequence (Obtained by the sum of the squares of the digits), are also happy numbers. Look at the example 1. Here, since 23 is a happy number, all other numbers in its sequence, i.e. 13, 10 and 1 are also happy numbers.
  2. If a number is unhappy, all the numbers in its sequence (obtained by the sum of the squares of the digits) are also unhappy numbers. In example 2, since 36 is an unhappy number, all the numbers in its sequence like, 45, 41, 17, 50, 25, 29, 85, 89, 145, 42, 20 and 4 are also unhappy numbers.
  3. The happiness of a number is unaffected, if the digits are rearranged in any manner.
  4. The happiness of a number is also unaffected, if one or more zeros are inserted anywhere in the number or removed from anywhere in the number.
  5. There are infinitely many happy numbers.
  6. There are infinitely many unhappy numbers.
  7. Any permutation or arrangement of the digits of a happy or unhappy number is also a happy or unhappy number.

Happy numbers between 1 to 100

1, 7, 10, 13, 19, 23, 28, 31, 32, 44, 49, 68, 70, 79, 82, 86, 91, 94, 97, 100

Happy numbers between 101 to 500

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

Happy numbers between 501 to 1000

536, 556, 563, 565, 566, 608, 617, 622, 623, 632, 635, 637, 638, 644, 649, 653, 655, 656, 665, 671, 673, 680, 683, 694, 700, 709, 716, 736, 739, 748, 761, 763, 784, 790, 793, 802, 806, 818, 820, 833, 836, 847, 860, 863, 874, 881, 888, 899, 901, 904, 907, 910, 912, 913, 921, 923, 931, 932, 937, 940, 946, 964, 970, 973, 989, 998, 1000

HAPPY LEARNING……………………………..

Share this