← Back to all activities한국어 → 📖 Read the article
🗼 Tower of Hanoi Lab

Move every disk
onto another peg!

A classic puzzle where you move every disk from the first peg to the third peg. There are only two rules — move just one disk at a time, and never put a larger disk on top of a smaller one.

The Tower of Hanoi is a puzzle invented in 1883 by the French mathematician Édouard Lucas. It comes with a legend about 64 disks — monks moving one disk a day would need hundreds of billions of years to finish — because the number of moves needed nearly doubles, explosively, with every single disk you add.

Tap a peg to pick up its top disk, then tap another peg to set it down. You can only set a disk down if the target peg is empty, or its top disk is bigger than the one you're moving.

With n disks, the theoretical minimum number of moves is 2ⁿ−1. To move one large disk, you first have to move every disk sitting on top of it onto another peg entirely — and this trick of breaking a problem down into a smaller version of the same problem is called recursion in computer programming.

Theoretical minimum moves (2ⁿ−1)
7 moves
Moves so far: 0
Towers completed: 0