Tower of Hanoi

About this tool

Move a stack of three to eight discs from the first peg to the last, one at a time, never putting a larger disc on a smaller one. Drag the top disc, tap a source peg and then a target, or press 1, 2 and 3; an illegal move shakes and says why. The counter shows the moves so far against the minimum 2ⁿ − 1. Auto-solve continues optimally from whatever position the class reached, at a speed you choose, and can be paused. A discussion panel gives the table of minimum moves, the reason the number doubles and adds one, and the story Édouard Lucas invented with the puzzle in 1883.

Classroom ideas

  • Let pairs solve 3, 4 and 5 discs, record the minimum moves and predict the number for 6 before checking.
  • Pause the class midway and use Solve from here to show that the best path continues from any position.
  • Open the discussion and ask how long 64 discs would take at one move per second.

Related tools