Interactive mathematical puzzle

Tower of Hanoi

Move every disc from the left peg to the right peg. Move one disc at a time and never place a larger disc on a smaller one.

Tower of Hanoi strategy

The puzzle becomes easier when you think recursively. To move a stack of n discs, first move the top n−1 discs to the spare peg, move the largest disc to the target peg, then move the smaller stack on top of it.

The minimum number of moves is 2n − 1: 3 discs need 7 moves, 4 need 15, 5 need 31, 6 need 63 and 7 need 127.

  • Never move a larger disc onto a smaller one.
  • When stuck, focus on where the largest unsolved disc must go next.
  • Use the optimal-move hint to study the pattern rather than simply completing the puzzle.

Computational thinking connection

Tower of Hanoi is a classic example of decomposition and recursion: a large problem is solved by repeatedly solving the same smaller problem. For a classroom-focused explanation, see Tower of Hanoi algorithms.

Puzzle instruction image