Skip to content
OneKitly

An Unhappy Number Always Falls Into the Same Eight-Step Loop

Published 10/26/2026 · 3 min read · Everyday calculators

Antonio Delgado

Antonio Delgado — Traditions & pastimes writer at OneKitly

Symbolism · Calendars

Checked against 2 sources

View profile →
In short

Take a number, square each of its digits, add the squares, and repeat. Nineteen gives 1 + 81 = 82, then 64 + 4 = 68, then 36 + 64 = 100, then 1 — four steps, and it is called happy. Four gives 16, then 37, 58, 89, 145, 42, 20 and back to 4, a closed loop of eight numbers it can never leave. What makes this more than a curiosity is that the loop is the only one there is: in base ten every starting number either reaches one or joins that exact cycle, and there is no third possibility. Starting at 42 shows the same cycle entered from a different point.

Advertisement

Square the digits and add. 19 reaches 1 in four steps. 4 does not, and neither does anything else that fails — every failure lands in 4, 16, 37, 58, 89, 145, 42, 20 and goes round for ever.

Why the process cannot run away

Squaring digits shrinks large numbers hard. A three-digit number produces at most 9² three times over, which is 243, so anything with three digits or more comes down immediately and stays below a thousand for ever after. That leaves only a finite set of values the process can ever visit, and a walk through a finite set with a deterministic rule must eventually repeat something. Once it repeats, it is in a cycle by definition. So there are no runaway starting values and no infinite wandering — the only question was ever how many cycles exist, and checking the finite range answers it.

Change the base and the answer changes

Everything above is a fact about writing numbers in base ten, not about numbers. The digits are a representation, the squaring acts on that representation, and a different base gives a different map with different cycles — some bases have several, some have longer ones, and the tidy picture of exactly one loop is a coincidence of ten. That makes the whole thing a good illustration of a distinction worth carrying around: properties like being prime or being even belong to a number, while properties like this one belong to how it happens to be written.

Four starting points
StartChainVerdict
100100 → 1Happy in one step
1919 → 82 → 68 → 100 → 1Happy in four steps
77 → 49 → 97 → 130 → 10 → 1Happy in five steps
44 → 16 → 37 → 58 → 89 → 145 → 42 → 20 → 4Unhappy — the loop
Happy number calculatorFind out whether a number is 'happy'. Repeatedly replace it with the sum of the squares of its digits: if you reach 1 it is happy; if you fall into the 4-16-37-58-89-145-42-20 loop it is unhappy. See the verdict and the full chain of steps.Try the tool →
Advertisement

Frequently asked questions

Are happy numbers useful for anything?
Not directly, and the honest answer is that they are a teaching device. What they demonstrate cheaply is the argument used seriously elsewhere: bound the process, conclude the state space is finite, deduce that repetition is forced, then enumerate the cycles. That reasoning is exactly what a computer scientist uses to prove a program terminates or to detect a loop in a linked structure, and having met it once on something as light as this makes it recognisable when it turns up attached to something that matters.
How were the cycles found in the first place?
By checking every value up to the bound and nothing more. Since no number above 243 can survive a step without dropping below it, running the rule on every integer from one to 243 covers every possible long-term behaviour, and the whole search fits comfortably on paper. That is the rare case where exhaustive checking is a proof rather than evidence: the bound turns an infinite question into a finite one, and the finite one was settled completely. Most conjectures resist precisely because no such bound exists.

Articles you may find interesting

All guides →

Related tools

Sources

Spotted a mistake in this article?