ArticleslgStudy

mathematics

Happy number

Happy number is a mathematics topic covered in the lgStudy science library. This page brings together a partial reference excerpt, illustrations, worked examples, real-world applications and a short study plan, so you can understand Happy number rather than just read about it. In short: In number theory, a happy number is a number which eventually reaches 1 when the number is replaced by the sum of the square of each digit. For instance, 13 is a happy number because 1 2 + 3 2 = 10 {\displaystyle 1^{2}+3^{2}=10} , and 1 2 + 0 2 = 1 {\displaystyle 1^{2}+0^{2}=1} .

Happy number — main illustration
Happy number — illustration

Key takeaways

  • Happy number belongs to mathematics; place it in that map before memorising details.
  • Learn the definition first, then one example that makes the definition concrete.
  • Connect Happy number to a quantity you can measure, compute or draw — that is where exam questions come from.
  • Reproduce the core statement of Happy number from memory before moving on to harder problems.

Reference excerpt

In number theory, a happy number is a number which eventually reaches 1 when the number is replaced by the sum of the square of each digit. For instance, 13 is a happy number because 1 2 + 3 2 = 10 {\displaystyle 1^{2}+3^{2}=10} , and 1 2 + 0 2 = 1 {\displaystyle 1^{2}+0^{2}=1} . On the other hand, 4 is not a happy number because the sequence starting with 4 2 = 16 {\displaystyle 4^{2}=16} and 1 2 + 6 2 = 37 {\displaystyle 1^{2}+6^{2}=37} eventually reaches 2 2 + 0 2 = 4 {\displaystyle 2^{2}+0^{2}=4} , the number that started the sequence, and so the process continues in an infinite cycle without ever reaching 1. A number which is not happy is called sad or unhappy. More generally, a b {\displaystyle b} -happy number is a natural number in a given number base b {\displaystyle b} that eventually reaches 1 when iterated over the perfect digital invariant function for p = 2 {\displaystyle p=2} . The origin of happy numbers is not clear. Happy numbers were brought to the attention of Reginald Allenby (a British author and senior lecturer in pure mathematics at Leeds University) by his daughter, who had learned of them at school. However, they "may have originated in Russia."

Happy numbers and perfect digital invariants

Formally, let n {\displaystyle n} be a natural number. Given the perfect digital invariant function

F p , b ( n ) = ∑ i = 0 ⌊ log b ⁡ n ⌋ ( n mod b i + 1 − n mod b i b i ) p {\displaystyle F_{p,b}(n)=\sum _{i=0}^{\lfloor \log _{b}{n}\rfloor }{\left({\frac {n{\bmod {b^{i+1}}}-n{\bmod {b^{i}}}}{b^{i}}}\right)}^{p}} . for base b > 1 {\displaystyle b>1} , a number n {\displaystyle n} is b {\displaystyle b} -happy if there exists a j {\displaystyle j} such that F 2 , b j ( n ) = 1 {\displaystyle F_{2,b}^{j}(n)=1} , where F 2 , b j {\displaystyle F_{2,b}^{j}} represents the j {\displaystyle j} -th iteration of F 2 , b {\displaystyle F_{2,b}} , and b {\displaystyle b} -unhappy otherwise. If a number is a nontrivial perfect digital invariant of F 2 , b {\displaystyle F_{2,b}} , then it is b {\displaystyle b} -unhappy.

For example, 19 is 10-happy, as

F 2 , 10 ( 19 ) = 1 2 + 9 2 = 82 {\displaystyle F_{2,10}(19)=1^{2}+9^{2}=82}

F 2 , 10 2 ( 19 ) = F 2 , 10 ( 82 ) = 8 2 + 2 2 = 68 {\displaystyle F_{2,10}^{2}(19)=F_{2,10}(82)=8^{2}+2^{2}=68}

… excerpt ends here. Continue reading the full article.

Illustrations

Happy number: Tree showing all happy numbers up to 100, and 130
Tree showing all happy numbers up to 100, and 130
Happy number: Sad numbers up to 100 showing the repeating cycle of 8 numbers
Sad numbers up to 100 showing the repeating cycle of 8 numbers

Worked examples

Example 1 — a first encounter with Happy number

Start with the simplest possible case. Write down what Happy number claims or describes in one sentence, then invent the smallest concrete situation in which that sentence is true. In mathematics, the smallest case is usually a single object, a single equation or a single measurement. Check that every symbol or term in your sentence has a meaning in that case.

Example 2 — changing one variable

Take the situation from Example 1 and change exactly one quantity: double it, halve it, or set it to zero. Predict what should happen to Happy number before you calculate. Comparing your prediction with the result is the fastest way to find out whether you understand the idea or only the words.

Example 3 — an exam-style question

Typical questions about Happy number ask you to (a) state it precisely, (b) apply it to given data, and (c) explain a limitation. Practise writing all three answers in under five minutes; the third part is what separates a full-mark answer from an average one.

Applications of Happy number

In research
Happy number appears in mathematics research whenever the underlying quantities have to be modelled precisely. Papers usually cite it as a starting assumption and then explore where it breaks down.
In technology and industry
Engineering practice reuses Happy number in design rules, simulations and safety margins. Knowing the idea lets you read a specification sheet and understand why the numbers look the way they do.
In the classroom
Happy number is common in secondary-school and first-year university syllabi. It links to neighbouring topics Arithmetic dynamics, Base-dependent integer sequences, so understanding it makes those chapters shorter.
In everyday life
Look for Happy number outside the textbook — in sport, cooking, traffic, electronics or the sky above you. An example you found yourself is remembered far longer than one you were given.
Ask Teacher Smith questions about this articleOpens your AI tutor with a question about “Happy number” →

Affiliate

Preply — study more efficiently by working with a personal tutor. 50% off.

How to study Happy number in 20 minutes

  1. Read the reference excerpt below once, without taking notes.
  2. Close the page and write down what Happy number means in your own words.
  3. Compare your version with the excerpt and mark what you missed.
  4. Work through the three examples above with pen and paper.
  5. Explain Happy number out loud to somebody else — or to Teacher Smith in the lgStudy chat.

Frequently asked questions

What is Happy number in simple terms?

In number theory, a happy number is a number which eventually reaches 1 when the number is replaced by the sum of the square of each digit. For instance, 13 is a happy number because 1 2 + 3 2 = 10 {\displaystyle 1^{2}+3^{2}=10} , and 1 2 + 0 2 = 1 {\displaystyle 1^{2}+0^{2}=1} .

Why does Happy number matter?

Because it connects several mathematics ideas at once: it gives you a definition you can apply, a quantity you can calculate, and a way to check whether a result is plausible.

How should I study Happy number?

Read the excerpt, restate it from memory, then work through the examples and applications listed on this page. The five-step study plan above takes about twenty minutes.

What does this page cover?

It gives you a compact reference excerpt plus original lgStudy explanations, examples, applications and study material on Happy number.

Tags

  • Arithmetic dynamics
  • Base-dependent integer sequences

Keep exploring