0% found this document useful (0 votes)
196 views

Happy Numbers

The document summarizes research on happy numbers conducted by Elizabeth Todd. It defines happy numbers as numbers that eventually reach 1 when the sum of the digits' squares is repeatedly calculated. Not all numbers exhibit this behavior, some enter cycles or fall into existing cycles. Todd explores happy numbers less than 100 and proves that all numbers must be happy, cyclic, or fall into an existing cycle. She also discusses how the concept generalizes to other exponents, introducing fixed point numbers that return to themselves under repeated calculation.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
196 views

Happy Numbers

The document summarizes research on happy numbers conducted by Elizabeth Todd. It defines happy numbers as numbers that eventually reach 1 when the sum of the digits' squares is repeatedly calculated. Not all numbers exhibit this behavior, some enter cycles or fall into existing cycles. Todd explores happy numbers less than 100 and proves that all numbers must be happy, cyclic, or fall into an existing cycle. She also discusses how the concept generalizes to other exponents, introducing fixed point numbers that return to themselves under repeated calculation.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 21

Iowa State University Capstones, Theses and

Creative Components Dissertations

Fall 2018

Happy numbers
Elizabeth Todd
Iowa State University

Follow this and additional works at: https://lib.dr.iastate.edu/creativecomponents

Part of the Other Mathematics Commons

Recommended Citation
Todd, Elizabeth, "Happy numbers" (2018). Creative Components. 109.
https://lib.dr.iastate.edu/creativecomponents/109

This Creative Component is brought to you for free and open access by the Iowa State University Capstones,
Theses and Dissertations at Iowa State University Digital Repository. It has been accepted for inclusion in Creative
Components by an authorized administrator of Iowa State University Digital Repository. For more information,
please contact [email protected].
Elizabeth Todd
Iowa State University
Master of School Mathematics Graduate Program
Creative Component
1

Table of Contents

1 Introduction to Happy Numbers 2

2 Other Exponents 6

3 Applications in the Classroom 10

4 Lesson Plan 13

5 Python Code 17

6 References 19
2

1 Introduction to Happy Numbers


Happy numbers were first introduced to me through the ​Holl Mini-Workshop for MSM

students at Iowa State University.​ The presenter, Leslie Hogben, led our group in an exploration

of happy numbers that invoked our curiosities and led to many interesting discoveries. While

happy numbers do not seem to have a practical application (that I’ve discovered at least), they

are an enjoyable recreational math concept.

Definition
Happy numbers are numbers greater than one such that when the digits of the number are

squared and summed repeatedly, the number eventually goes to 1. For example, take the number

82. 82 + 22 = 68 ; 62 + 82 = 100 ; 12 + 02 + 02 = 1 . Since 82 eventually went to 1, 82 is a

happy number. However, not all numbers exhibit this type of behavior. Consider the number 4.

4 yields a different, and most interesting result. 42 = 16; 12 + 62 = 37 ; 32 + 72 = 58;

52 + 82 = 89; 82 + 92 = 145; 12 + 42 + 52 = 42; 42 + 22 = 20; 22 + 02 = 4 . From this we see that

4 is part of a cycle, because applying the function of squaring the digits and taking their sum will

eventually lead back to the initial number. Once you reach a number in the cycle, you will stay

in the cycle indefinitely. There are eight numbers (4, 15, 37, 58, 89, 145, 42, 20) in this cycle. A

number may also “fall into” the cycle. A number like 90 is not part of the cycle, but by applying

the function, it will eventually reach a number in the cycle. 92 + 02 = 81 ;

82 + 12 = 65 ; 62 + 52 = 61; 62 + 12 = 37 . 37 is a part of the cycle, so 90 fell into the cycle.


3

Happy Tree

At the Holl workshop, our group started by investigating the numbers 1 - 100 and

determined if they were happy, part of the cycle, or go to the cycle. The tree in Figure 1

shows all the numbers less than 100 that are happy, and how they get to 1. The remaining

numbers less than 100 are in the cycle or fall into the cycle (4, 15, 37, 58, 89, 145, 42, 20). The

tree uses numbers greater than 100 (such as 130) where necessary in order to complete the tree.

This “happy tree” is based on the drawing of Matt Parker from Numberphile Youtube video

series. [6]

Figure 1: Happy Tree


4

Naturally this poses the question, will this tree “grow” forever? In other words, are there

infinitely many happy numbers? Well to become happy, the sums of squares need to eventually

lead to 1. Any power of 10 would fit that description, as all powers of 10 begin with a digit of

one, followed by zeros. Therefore there are infinitely many happy numbers, as there are an

infinitely many powers of 10.

Cycle
The happy tree contains only a small fraction of the numbers less than 100. Happy

numbers has a lower density of 0.1138 and the upper density of 0.18577. [5] During the

workshop we found that the rest of the numbers were either part of the cycle or go to the cycle.

Matt Parker [6] dubbed this cycle, and the numbers that go into it, the “melancoil.” Figure 2

shows all the numbers less than 100 that are either part of the cycle or go to the cycle. It also

includes three digit numbers when necessary to complete the diagram.

This diagram shows some interesting discoveries. The trees that span from the cycle vary

greatly in length, with no numbers leading to 42 (except those within the cycle) and forty-two

numbers leading to 89. It begs the question- if we were to continue towards infinity, would there

still be no numbers leading to 42? Would there still be a larger amount of numbers leading to

89? These would be interesting questions for further research.


5

Figure 2: Melancoil

Behavior of Numbers
At the Holl workshop, we determined the classification of numbers less than 100 and

then posed the question, can we prove that ​all ​numbers are either one, happy, part of the cycle, or

go to the cycle? If we could show that applying the function of summing the squares of the

digits to a number greater than 100 ​always​ produced a smaller value, we could conclude that all

numbers eventually led to two digit numbers, and given that all two digit numbers are either one,
6

happy, part of a cycle, or goes to the cycle, we would be able to conclude all numbers do so as

well. By testing several numbers, we saw that it did, indeed, appear to decrease in value. The

theorem and its proof follows below.

A number with n + 1 digits can be written as an an−1 ...a0 (and juxtaposition does not

imply multiplication). For a = an an−1 ...a0 , define S 2 (a) = a2n + a2n−1 + ... + a20

Lemma 1: For a ≥ 100 , S 2 (a) < a

Proof: Assume n ≥ 2 . Consider a number a with n + 1 digits and assume that

S 2 (a) > a . Or in another way, a2n + a2n−1 + ... + a20 ≥ 10n an + 10n−1 an−1 + ... + a0

Given that an , an−1 , ... a0 are single digit positive integers and the leading digit ≠ 0, then

10an > an 2 . Therefore, 10an + 10an−1 + .... + 10a0 > a2n + a2n−1 + ... + a20 and by substitution

10an + 10an−1 + .... + 10a0 ≥ 10n an + 10n−1 an−1 + ... + a0 . Simplifying the expression we have

9a0 ≥ (10n − 10)an + (10n−1 − 10)an−1 + .... + 90a2 . This is a contradiction because 9a0 ≤ 81

and (10n − 10)an ≥ 90 .

Theorem 2: All numbers are either one, happy, part of the cycle, or goes to the cycle.

Proof: By Lemma 1, repeatedly applying the sum of squares of digits function to a base

10 number greater than 100 will eventually lead to 2 digit number, indicating all numbers are

either one, happy, part of the cycle, or go to the cycle. ▢

2 Other exponents
Consider what happens if the iterated function used an exponent other than 2; what

changes would occur? This question led me to the discovery of fixed points. With an exponent
7

of 2, 1 was the only number that returned itself. With an exponent of 3, that is not the case.

While 1 still returns 1, there are other numbers that do the same thing. There are five fixed

numbers to be exact- 1, 153, 370, 371, and 407. This will be established below and is known [2].

For all of these numbers, if their digits are cubed, the sums of the cubes returns the same number.

The last four numbers are also known as “narcissistic numbers.” Wolfram Math World defines

narcissistic numbers as “An ​n-​ ​digit​ number that is the ​sum​ of the ​nt​ h ​powers​ of its ​digits​ is called

an ​n-​ narcissistic number. It is also sometimes known as an Armstrong number, perfect digital

invariant, or plus perfect number.” [7]

Thus we now have five options for all numbers; they are either fixed, happy, part of the

cycle, go to the cycle, or go to a fixed point. To find the fixed points, we need to apply the

function to numbers one by one and identify the numbers that return themselves. (This is best

done through the aid of programming.) Fortunately, just like the function with an exponent of 2,

applying the function with higher exponents will eventually decrease the number as well.

Therefore to find the fixed points for any exponent, we do not need to search all numbers, just

those below a certain bound. The higher the exponent, e , the higher the bound. A proof of the

bound of 10e+1 is reproduced below.

For a = an an−1 ...a0 , define S e (a) = ane + an−1


e + ... + ae given an exponent e .
0

Theorem 3: S e (a) < a when a ≥ 10e+1 [1]

Proof: Suppose that a ≥ 10e+1 . Then a = 10n an + 10n−1 an−1 + ... + a0 , where

an , an−1 , ... a0 are single positive integers, an ≠ 0 , and n ≥ e + 1 . Given that a is n + 1 digits

long, and each digit is at most 9, S e (a) ≤ (n + 1)9e


8

10n = (9 + 1)n

> 9n + (n)9n−1

> 9e + (n)9e

= (n + 1)9e

So then 10n > (n + 1)9e , and by substitution S e (a) ≤ 10n . Since a ≥ 10e+1 , then S e (a) < a. ▢

We now turn our attention to the cycle, or rather, the cycles. When the exponent was 2,

there was one cycle of eight numbers. However, using the exponent of 3 yields four small cycles

of numbers. They are: (55, 250, 130); (136, 244); (160, 217, 352); (919, 1459) [2] By Theorem

2, we know that these are the only cycles given that all numbers greater than 10,000 will

decrease under the operation of summing cubes of digits, and these were the only cycles found

for numbers less than 10,000.

The happy numbers of exponent 3 also have unique qualities. While there is no pattern to

happy numbers (that is currently known at least), cubic happy numbers share that quality that

they are all congruent to 1 modulo 3. [2] The proof is reproduced below.

Proof: Consider the cubic happy number an an−1 ...a0 (where juxtaposition does not imply

multiplication) or written another way 10n an + 10n−1 an−1 + ... + a0 . Given that fact that

a3 ≡ a (mod 3) and 10n ≡ 1 (mod 3), then an 3 + an−1 3 + ... + a0 3 ≡ an + an−1 + ... + a0 (mod 3)

and 10n an + 10n−1 an−1 + ... + a0 ≡ an + an−1 + ... + a0 (mod 3). Given that the sum of the digits

cubed of happy numbers eventually equal 1, and 1 ≡ 1 (mod 1), then all happy numbers are

congruent to 1 modulo 3. ▢

There are many differences between the behavior for numbers with exponents of two and

exponents of three. This raises the question, what happens with other exponents? How many
9

fixed points and cycles will they yield? Is there any way to predict these number of fixed points

and cycles? These questions are best answered with the assistance of a program.

Given an exponent e , the program will need to search through 10e+1 for all fixed points

and cycles. As the exponent increases, the program will have ten times more numbers to search

through, and therefore at some point comprehensive list of fixed points will not be possible.

However, the program was able to find all the fixed points for exponents 2-7, and cycles for 2-6

in a reasonable amount of time. The results are listed in the table below.

Exponent Fixed Points Cycles


2 1 (4, 15, 37, 58, 89, 145, 42, 2)
3 1 (55, 250, 130)
153 (136, 244)
370 (160, 217, 352)
(919, 1459)
371
407

4 1 (13139, 6725, 4338, 4514, 1138, 4179, 9219)


1634 (2178, 6514)
8208
9474
5 1 (244, 2080, 32800, 33043, 1753, 20176, 24616, 16609, 74602,
4150 25639, 70225, 19996, 184924, 93898, 183877, 99394, 178414,
4151 51625, 14059, 63199, 126118, 40579, 80005, 35893, 95428, 95998,
54748
213040, 1300)
92727
93084 (92873, 108899, 183635, 44156, 12950, 62207, 24647, 26663
194979 23603)
(8294, 9044, 61097, 83633, 41273, 18107, 49577, 96812, 99626,
133682, 41063)
(8299, 150898, 127711, 33649, 68335, 44155)
(9045, 548525, 313179, 650550, 63198, 99837, 167916, 91410,
60075, 27708, 66414, 17601, 24585, 40074, 18855, 71787, 83190,
92061, 66858, 84213, 34068, 41811, 33795, 79467, 101463)
(10933, 59536, 73318, 50062)
10

(24594, 37973, 93149, 119366, 74846, 59399, 180515, 39020,


59324, 63473, 26093, 67100)
(58618, 76438)
(89883, 157596)

6 1 (17148, 383891, 1057188, 657564, 246307, 169194, 1113636,


548834 94773, 771564, 301676, 211691, 578164, 446171, 172499,
1184692, 844403, 275161, 179996, 1758629, 973580, 927588,
1189067, 957892, 1458364, 333347, 124661, 97474, 774931,
771565, 313205)
(23949, 1083396, 841700, 383890, 1057187, 513069, 594452,
570947, 786460, 477201)
(63804, 313625)
(93531, 548525, 313179, 650550)

7 1
1741725
4210818
98000817
9926315
14459929
Table 1

3 Applications in the Classroom


I have the pleasure of teaching Algebra 1 to 8th grade students and wanted to give them

an opportunity to develop number sense, look for patterns, and build an understanding of

recursive functions through exploring happy numbers. In the lesson, we started off by building

an understanding of what it means to “sum the squares of the digits of a number.” Students were

not accustomed to seeing functions rewritten descriptively, rather than with an equation.

I took the number 23 and summed the squares of the digits. I asked the students what

they think would happen if I kept doing this. Most students, inaccurately, thought that the

number would mostly increase and keep increasing. I think that came from an understanding
11

that squaring a number makes it bigger, but they did not think about how the biggest square of a

digit we would have is 81.

After students saw that 23 lead to 1 through the recursive function, I defined all such

numbers as “happy.” For middle schoolers, clear definitions are important, as well as being able

to describe them in their own words. The first thing I had students do in their groups was write

their own definition of happy numbers. This allowed me to check understanding of happy

numbers before moving on.

I then challenged students to find as many happy numbers as they can. This showed

students that there are many happy numbers, that there are patterns to happy numbers, and it

helped students develop number sense and an understanding of happy numbers. This part of the

lesson provoked curiosity and creativity from the students. Many students realized that the

numbers that we found from 23 on our way to 1 (13, 10, and 1) are also happy numbers. They

also quickly learned that the reverse of these numbers were also happy. In other words, the order

of the digits did not matter. Other students realized that all the powers of 10 are happy, or started

taking the numbers 23, 13, etc and adding zeros onto the end. One student realized if the sum of

the squares was 10, the number was happy. The easiest route for him to do this was the number

1,111,111,111. Another student, having the same realization, stuck to the digits of 0, 1, 2, and 3

and found many unique numbers others did not consider, such as 2,211 or 301. She transposed

these numbers into many other numbers.

After giving students sufficient time to find these patterns, we discussed and highlighted

the key findings as a class. When posed with the question “Are there an infinite amount of

happy numbers?” a few students seemed stumped or unsure, but many quickly surmised that
12

because there are an infinite amount of powers of 10, there are naturally an infinite amount of

happy numbers. Then I asked the class “Are there non-happy numbers?” Many realized that

there are non-happy numbers, and one student predicted that non-happy sum to single digits

other than 1. Another student disproved this with the number 7, and we also talked about how

we do not stop summing the digits with a recursive function just because we reached a single

digit.

To introduce the cycle, I used the number 4, and said we will investigate what happens

when we sum the squares of the digits. We continued to do this until we reached the number 4

again. Some students were flummoxed why I stopped, while other students immediately let out a

knowledgeable “ohhhhhhhhh.” Using the age-old wise teaching words of “what do you notice?”

students pointed out that we ended up back where we started, that the numbers got stuck in a

loop. From here other questions arose: “Are there other cycles?” “What about the numbers that

are not part of cycle?”

While we did not reach a conclusion to the first question (some students did hang out

after class to ask more questions about that), we did figure out what happens to numbers that

were not happy or part of the cycle. Using another example, students discovered that other

numbers lead to the cycle. Students used the last few remaining minutes to fill out a table and

label numbers a happy, part of the cycle, or goes to the cycle. Based off of the natural curiosity

and questions that they posed, a good follow lesson would be to look at other exponents.
13

4 Lesson Plan

Overview of Lesson
Students will introduced to the concept of a recursive function through happy numbers.
Students will explore the different outcomes that will occur through this function, and make
predictions. Students will be guided to prove their predictions. Students can also extend their
exploration of happy numbers by using different exponents or bases.

Common Core State Standards for Mathematical Practice


MP1​ Make sense of problems and persevere in solving them.
MP3​ Construct viable arguments and critique the reasoning of others.
MP7​ Look for and make use of structure.
MP8​ Look for and express regularity in repeated reasoning.

Learning Objectives
The objective of this lesson is focused on reasoning and problem solving skills. Students
will be making sense of the recursive function for happy numbers. Using that structure, students
will see how the function results in two different outcomes. Students will construct an argument
as to whether there it is possible to have more than those two outcomes. This relates to the Iowa
Core Standard HSF.BF.A.1.a
“Determine an explicit expression, a recursive process, or steps for calculation from a context.”

Prerequisites
Students should have background knowledge on using exponents. Knowledge of other
bases can help extend the lesson, but is not required.

Time Required
45- 90 minutes. Basics of the lesson can be done in one class period, but further
explorations and extensions could make this two class periods.

Materials and Preparation Required


Student handout, calculators
14

Lesson Plan

Introduction
Start with the number 23. Define what it means to “sum the squares of the digits.” Ask
the students to make a prediction about what will happen. (Will the value increase? Decrease?
Stay the same?) Repeat summing the squares until you get to one. Ask the students what
happens when we sum the squares of 1. Ask students if they think this will happen with any
other numbers. Define these numbers as “happy numbers.”

Cycle
Ask students to share their happy numbers, and highlight any patterns, such as 10, 100,
1000, etc. Then ask students to share numbers that were not happy. Highlight one of the
numbers that is part of the cycle. Use the number to introduce the cycle. Ask students to explain
why a cycle occurred, and predict if any other numbers would enter into this cycle. Ask students
to predict if there are any other cycles.

Testing Numbers
Students should define what the possible results of recursive function are. Then have
students work collectively to complete the table. Ask students to define any patterns they see,
such as numbers like 23 and 32 both are happy.

Proofs, Predictions, and Extension


After completing the table, ask students if they all numbers will behave the same way.
Guide students to prove their hypothesis. Or consider having students make and test predictions
about changing the function to an exponent of 3 or using a different base.
15

Student Handout
Write your own definition of a happy number

With your group, find as many happy numbers as you can

What do you notice about the non-happy numbers?

What are the possible results of the recursive function?


16

Determine if the following numbers in the table are happy, part of the cycle, or go to the cycle

Do you notice any patterns with the numbers that are happy?
17

5 Python Code for Fixed Points and Cycles


18
19

6 References
[1] Budden, C., Chalmers, J., Hogben, L., Reece, B., Wilson, U., & Yoder, L.
Adventures with numbers and iteration. Preprint. (2014)

[2] Grundman, H. G., & Teeple, E. A. Generalized Happy Numbers. ​The Fibonacci
Quarterly,​ 39​(2001), 462-466.

[3] Grundman, H. G., & Teeple, E. A. Iterated Sums of Fifth Powers of Digits ​Rocky
Mountain Journal of Mathematics, ​38(2008), 1139- 1146

[4] Hogben, L. (2017, June 14). ​Happy Numbers.​ Lecture presented at Holl Mini-Workshop
for MSM students at Iowa State University, Ames.

[5] OEIS, The Online Encyclopedia of Integer Sequences. Sequence A007770 (2018)

[6] Parker, Matt (2012, February 26). 145 and the Melancoil. Retrieved November 06,
2017, from ​https://www.youtube.com/watch?v=_DpzAvb3Vk4

[7] Weisstein, Eric W. "Narcissistic Number." From MathWorld--A Wolfram Web Resource.
http://mathworld.wolfram.com/NarcissisticNumber.html

You might also like