The Towers of Hanoi
Move a stack of disks from one peg to another without ever putting a bigger disk on a smaller one. Play it, watch the best solution, count the moves and see the binary pattern inside.
Key takeaways
- The Towers of Hanoi was sold in 1883 under the name N. Claus de Siam, an anagram of Lucas d’Amiens, Édouard Lucas.
- To move n disks you need at least 2 to the n minus 1 moves. Each extra disk doubles the work.
- The best way is recursive: move the pile above the biggest disk away, move the biggest, move the pile back.
- 64 disks need 18,446,744,073,709,551,615 moves, about 585 billion years at one move a second.
- The disk that moves is given by the lowest 1 in the move number written in binary, which links the puzzle to counting and the Gray code.
Sources
Most of these sites could not be opened while this page was written, so the facts were checked through search results that quote them. Lucas presenting the puzzle in 1883 as N. Claus de Siam, the anagram of Lucas d’Amiens, the legend of the temple with 64 golden disks (it is not clear whether Lucas invented it or was inspired by it), the fewest moves of 2 to the n minus 1, the 18,446,744,073,709,551,615 moves for 64 disks and the figure of about 585 billion years at one move a second, the recurrence of twice the fewest for one disk less plus one, and the link with binary counting and the Gray code each appeared in at least two places. Sources differ on the details of the legend, and one gives a different figure for the years, which is wrong by the arithmetic. The page does not say where the temple is. The counts and the times are computed on the page and the best solution is checked move by move by the page’s own code.
- Wikipedia: Tower of HanoiHistory, legend, the rule and the move count.
- MacTutor: the Towers of HanoiLucas and the legend.
- ProofWiki: Tower of HanoiThe fewest moves and a proof.
- ProofWiki: historical noteThe story of the disks and the years.
- Scientific American: the Tower of HanoiThe puzzle and where to start.
- Runestone Academy: Tower of HanoiThe recursive rule.
- University of Arizona: Hanoi notesThe recurrence for the move count.
- arXiv: Fibonacci-like sequences, graphs and Gray codesBinary labels and the disk that moves.
- arXiv: optimality proofs and multi-peg boundsWhy the biggest disk moves once.