Puzzle Desk

Tower of Hanoi

Move the whole tower to the goal peg, one disc at a time. A larger disc may never sit on a smaller one.

0:00time
0moves

How to play Tower of Hanoi

How to play

Tap a peg to lift its top disc, then tap another peg to put it there. You can also drag the top disc straight onto a peg. Only the top disc of a peg can move, and it may only go on an empty peg or on a larger disc.

How to win

Gather every disc on the goal peg, largest at the bottom. The bar above the board shows the fewest moves possible, so you can aim for a perfect solve.

Tips

With an odd number of discs, move the smallest disc to the goal peg first; with an even number, move it to the spare peg. After that, alternate: move the smallest disc one step round, then make the only other legal move.

Mixed tower and daily

The mixed tower starts with six discs spread over the pegs in a random legal arrangement. The daily mixed tower is the same for everyone.

Questions

What is the minimum number of moves for the Tower of Hanoi?

With n discs it is 2 to the power n, minus 1. That is 7 moves for 3 discs, 15 for 4, 31 for 5, 63 for 6 and 127 for 7. Every extra disc doubles the work and adds one.

Is there a trick to solving the Tower of Hanoi?

Yes. To move a tower of n discs, first move the n-1 smaller discs out of the way to the spare peg, then move the largest disc, then move the n-1 discs back on top of it. In practice: on every second move shift the smallest disc one peg round in the same direction, and in between make the only legal move that doesn't touch it.

What does the hint do?

It works out the shortest way to finish from your current position, even after mistakes, lifts the disc to move and marks where it should go. It also tells you how many moves are left at best.

Who invented the Tower of Hanoi?

The French mathematician Édouard Lucas published it in 1883, with a story about temple priests moving 64 golden discs. Moving 64 discs would take over 18 billion billion moves.

More games