Back to index
Overview
Tower of Hanoi icon HT

Tower of Hanoi

하노이의 탑

Move the entire stack to another peg—one disk at a time, never on a smaller disk.

Deceptively simple rules with a clean mathematical core—watch your move count drop as you learn the pattern.

Players: 1P Session length: 2-15 min
Logic PuzzleClassic

Goal & Core Rules

Transfer all disks from the start peg to the target peg, following the size-order rule.

  • Only one disk may be moved at a time.
  • A disk can be placed only on an empty peg or on top of a larger disk.
  • Goal: move the full stack from the start peg to the target peg.
  • The fewest moves for n disks is 2^n − 1.

Controls

Mouse

  • Click a cell/element to select
  • Use the input UI (numbers/marks/lines) to apply
  • Right click/secondary action: mark or erase (if supported)

Keyboard

  • Number keys: enter value (if supported)
  • Backspace/Delete: clear (if supported)
  • Arrow keys/Tab: move focus (if supported)

Touch

  • Tap: select/enter
  • Long-press: mark/secondary action (if supported)
  • Use the on-screen pad/buttons to input

Beginner Tips

  • Aim for the smallest disk to move every other turn—this keeps the process structured.
  • Think in subgoals: move n−1 disks aside, move the largest, then rebuild on top.
  • Count moves: knowing the minimum helps you judge efficiency.

Advanced Tips

  • Memorize the recursive pattern; for 3 pegs, the optimal solution is deterministic.
  • Use symmetry: the sequence for moving a stack left mirrors moving it right.
  • For larger n, focus on maintaining a rhythm rather than reacting move-by-move.

Origins & History

The Tower of Hanoi is widely believed to have been invented in 1883 by the French mathematician Édouard Lucas, though details of its origin have been debated.

Timeline

  1. 1883 Édouard Lucas is widely credited with inventing/presenting the Tower of Hanoi puzzle.

Notable People

  • Édouard Lucas French mathematician associated with the puzzle (1883)

FAQ

Is there always a unique optimal solution?

For the classic three-peg puzzle, the shortest solution length is fixed, and the move pattern is essentially determined.

Why does the minimum equal 2^n − 1?

Because moving the largest disk requires clearing n−1 disks first, which recursively doubles the work.

What’s a good disk count to start with?

Try 3–5 disks to learn the pattern, then increase.

Related Games