Where the Tower of Hanoi actually gets used

2026-10-22

Most puzzles stay puzzles. Tower of Hanoi escaped — the structure behind stacking disks on three pegs turns out to be genuinely useful in computing, medicine and engineering. If you missed it, the maths of the puzzle itself is worth a read first. Here's where it shows up in the wild.

Backup rotation schedules

Long before cloud storage, sysadmins had a problem: keep recent backups and deep history without buying infinite tapes. The "Tower of Hanoi rotation" solves it exactly like the game — media sets are recycled on a doubling schedule, so set A rotates daily, set B every other day, set C every fourth, and so on. The result is the same 2ⁿ − 1 arithmetic: a few tapes yield recent daily copies plus monthly and yearly restore points stretching far back. Some backup software still ships this scheme by name.

Testing your brain

Walk into a neuropsychology clinic and you may well be handed a Tower of Hanoi (or its close relative, the Tower of London). It's a standard assessment of executive function — planning ahead, holding sub-goals in memory, resisting the obvious-but-wrong move. Clinicians use it to evaluate frontal-lobe injuries, ADHD and early dementia. The scoring metric is elegant: count how far a patient's solution strays from the optimal 2ⁿ − 1. The puzzle literally measures how well you plan.

Gray codes and position encoders

In an optimal Hanoi game, exactly one disk moves per turn — never two. That property is the same one engineers want from position sensors. Ordinary binary counting flips several bits at once (0111 → 1000), so a sensor sampled mid-transition can read nonsense. Gray code fixes it by changing a single bit per step — and the Hanoi move sequence is a Gray code in disguise. Rotary and linear encoders in printers, robotics and industrial kit count in Gray code for exactly this reason.

The template for recursion

"Move n−1 disks, move the big one, move n−1 back" is divide-and-conquer in its purest form — which is why Hanoi is the first recursive algorithm most programmers meet. The same shape runs through merge sort, fast Fourier transforms and file-tree traversal: solve by shrinking the problem until it's trivial. If a codebase recursively calls itself twice around a pivot, you're looking at Hanoi's skeleton.

Not bad for a toy invented in 1883 with an apocalyptic legend attached. Try the puzzle that ended up inside backup schedules and brain scanners: play Tower of Hanoi, or take today's board in the Daily Set.

All posts · All puzzles