The Tower of Hanoi and the end of the world
Priests are said to be moving 64 golden discs, one at a time. When they finish, the legend says, the world will end.
The story
In 1883 the French mathematician Édouard Lucas sold a new puzzle: a stack of discs on one of three pegs, smallest on top. The aim is to move the whole stack to another peg, one disc at a time, never putting a larger disc on a smaller one.
To advertise it he told a legend. In a great temple in Benares (Varanasi), priests move a tower of 64 golden discs by the same rules, one move a day since the beginning of time. When the last disc is placed, the world will end.
Should we worry? The smart way to move n discs is: move the top n − 1 out of the way, move the biggest disc, then move the n − 1 back on top of it. Each extra disc doubles the work and adds one move, so n discs need 2ⁿ − 1 moves. For 64 discs that is about 18 quintillion moves. Even at one move every second, it would take about 585 billion years, over 40 times the age of the universe.
Play with it
How it works, step by step
- 1
One disc: 1 move.
- 2
To move n discs, first move the top n − 1 to the spare peg.
- 3
Move the largest disc to the target peg.
- 4
Move the n − 1 discs on top of it.
- 5
Moves(n) = 2 × Moves(n − 1) + 1, which gives 2ⁿ − 1.
n discs need 2ⁿ − 1 moves: solve the smaller tower, move the big disc, solve the smaller tower again.
Try it yourself
1What is the fewest moves needed for 5 discs?
2If 6 discs take 63 moves, how many do 7 discs take?
3What is the first thing to do when moving a tower of n discs?
Did you know?
- Solving a problem by using the answer to a smaller version of the same problem is called recursion. Computer programs use it all the time.
- Lucas also studied Fibonacci numbers, and a related list of numbers is named after him: the Lucas numbers.
- The puzzle is a favourite first example in computer-science courses.