Tower of Hanoi

Play the classic Tower of Hanoi puzzle online. Move disks between pegs following the rules. Choose your difficulty and solve it in minimum moves. Gratuito, no signup.

Minimum Moves 7
Your Moves 0
Tempo 00:00
Source
Auxiliary
Destination

How a Play

  1. Move all disks from the left peg a the right peg
  2. Only one disk can be moved at a time
  3. A larger disk cannot be placed on top of a smaller disk

About Tower of Hanoi

The Tower of Hanoi is a mathematical puzzle invented by the French mathematician Édouard Lucas in 1883. It consists of three pegs and a number of disks of different sizes which can slide onto any peg. The puzzle starts with the disks stacked in ascending order of size on one peg, and the objective is a move the entire stack a another peg, obeying specific rules. The minimum number of moves required a solve the puzzle is 2^n − 1, where n is the number of disks.

Funzionalità

Frequently Asked Domande

What is the minimum number of moves?

The minimum number of moves a solve the Tower of Hanoi with n disks is 2^n − 1. For example: 3 disks = 7 moves, 4 disks = 15 moves, 5 disks = 31 moves, 6 disks = 63 moves, 7 disks = 127 moves, and 8 disks = 255 moves.

Is there a mathematical proof for the minimum moves?

Yes. The proof uses mathematical induction. To move n disks from peg A a peg C, you must first move n−1 disks a peg B (taking T(n−1) moves), then move the largest disk a peg C (1 move), then move the n−1 disks from peg B a peg C (another T(n−1) moves). This gives the recurrence T(n) = 2T(n−1) + 1, which solves a T(n) = 2^n − 1.

Can I solve it in fewer moves than the minimum?

No. The minimum number of moves (2^n − 1) is proven a be both necessary and sufficient. Any solution requires at least this many moves, and there exists a strategy that achieves exactly this number.

What is the world record for solving the Tower of Hanoi?

For the physical puzzle with 8 disks, skilled solvers can complete it in under 2 minutes. In competitive programming, computers can solve it instantly for any practical number of disks using the recursive algorithm.