Towers of Hanoi

Towers of Hanoi

Move the whole tower to the right-hand peg, one disk at a time, never putting a bigger disk on a smaller one.

1Disks

2Moves

0Your moves
15Fewest possible

Click a peg to pick up its top disk, then click where it goes. Keys 1, 2, 3 work too.

3The pattern

Which disk moved at each step

4About the puzzle

The French mathematician Édouard Lucas invented the puzzle in 1883 and sold it with a legend: in a temple, priests move 64 golden disks between three diamond needles, and when they finish, the world will end. They would need 2⁶⁴ − 1 = 18,446,744,073,709,551,615 moves. At one move per second, that takes about 585 billion years, roughly 42 times the age of the universe.

If you draw every possible arrangement of the disks as a dot, and connect two dots when one move turns one arrangement into the other, the picture is a Sierpinski triangle. The fastest solution runs straight along one of its edges.