# How to find a happy number

Published: Mar 15, 2018 3 min read

#### STEM learning

How to find a happy number

The World Happiness Report 2017 states that Norway is the happiest nation in the world, with the United Kingdom ranking 19th out of the 51 countries surveyed.

20 March 2018 marks the United Nations International Day of Happiness, recognising the relevance of happiness and well-being as universal goals and aspirations in the lives of human beings around the world.

### Happiness and mathematics: the perfect formula

Mathematics is widely recognised as a key component in achieving many of these goals, both at a personal and national level. Happy numbers offer a great way to bring International Day of Happiness into the classroom.

To find out if a number is happy, replace the number by the sum of the squares of its digits. Repeat the process until either the number equals 1 or loops endlessly in a cycle that does not include 1. When the process ends with 1 then the number is described as a happy number, otherwise, it is an unhappy number.

Using 23 as an example:

22 = 4

32 = 9

4 + 9 = 13

Hence 23 is replaced by 13. The process is now repeated:

12 = 1

32 = 9

1 + 9 = 10

Hence 13 is replaced by 10. The process is now repeated:

12 = 1

02 = 0

1 + 0 = 1

The process ends at this point since 12 = 1. From this we conclude that 23 (and 13 and 10) are happy numbers.

Unhappy numbers migrate towards a cyclical loop that includes 4, 16, 37, 58, 89, 145, 42, and 20. When considering numbers between 1 and 100, some of the paths for unhappy numbers can be quite lengthy, for example, 60 takes nine intermediate steps before migrating to the cyclical loop. The image below illustrates the connections between unhappy numbers.

There are a number of ways this investigation can be used in the classroom. There are twenty happy numbers between 1 and 100, finding two or three of them is a task that is accessible to a wide range of students during a lesson introducing square numbers.

There are ways to introduce more problem-solving skills into the work. A strategy for reducing work is to realise that multiplying a number by 10 gives the same result. So, the fact that 6 is an unhappy number means that 60 is also unhappy. Reversing digits also yields the same result, so the fact that 24 is not a happy number means that neither is 42.

These strategies can be combined and used to work backwards from 1 to find happy numbers. It follows that 10 and 100 are also happy. Focussing for now on 100, the task becomes one of ‘finding squares that sum to 100’.

62 + 82 = 100

Hence the next numbers in the diagram are 68 and 86. There are no squares that sum to 86, so that branch comes to an end. However,

82 + 22 = 68

hence the next numbers in the diagram are 82 and 28. There are no squares that sum to 28, so that branch comes to an end. However,

92 + 12 = 82

Hence the next numbers in the diagram are 91 and 19. There are no squares that sum to either 91 or 19, and hence both branches come to an end. The thinking behind constructing the branch from 10 works in a similar way.

### Bursary-supported CPD to boost your confidence

If you are looking for inspiration for your mathematics teaching, join us at the National STEM Learning Centre and get involved with our bursary-supported CPD.