Towers of Hanoi

The Towers of Hanoi is a mathematical puzzle consisting of three rods and a set of disks of varying sizes, initially stacked in decreasing order on one rode. The objective is to move the entire stack to another rod, following the rules that only one disk can be moved at a time and no disk may be placed on top of a smaller disk.

The puzzle was invented by Eduard Lucas in 1883, who first presented it under the pseudonym "N. Claus," an anagram of his own name. The puzzle was published in Lucas's book 'Recreations Mathematiques', marketed as a game for children.

Upon publishing the puzzle, Lucas also include a legend of the Tower of Brahma, a temple in Benares. According to the legend Brahmin priests were moving 64 golden disks between 3 pegs, when the final disk was moved, the world would end. Though largely a marketing device, the story blended myth with magic to capture imagination of players. Variations on the legend have the temple in different locations, such as Hanoi, Vietnam, and sometimes described the priests as monks who could move only one disk per day.

Mathematically, the puzzle is notable for its recursive solution, describing the minimum number of moves to solve the puzzle. The Tower of Hanoi is a classic puzzle in both mathematics and computer science, and remains popular in both educational settings and as a toy worldwide.

Play Towers of Hanoi

Wooden disks on the center peg

Tower of Hanoi

Math Is Fun

math is fun tower of hanoi applet
Recursion Video Thumbnail

Towers of Hanoi Math Algorithm Explained

Recursion Video Thumbnail

What is Recursion?

Recusion explained in the context of the Tower's of Hanoi problem.