Tower of Hanoi

Tower of Hanoi

The Tower of Hanoi is a mathematical puzzle.



Édouard Lucas, Hanoi, recursive, algorithm, logic puzzle game, logical exercise, disk game, game, mathematics, logic, mathematician, exercise, puzzle, end of the world, Hinduism, Brahma

Related items


Manual control

The Tower of Hanoi is a mathematical puzzle. It is also known as the Tower of Brahma or Lucas' Tower.

The Tower of Hanoi puzzle consists of three rods, and disks stacked on one of the rods in ascending order of size. (The number of rods is fixed, but the number of disks can be changed.) The objective of the puzzle is to move the entire stack of disks from the first rod to the last, obeying the following rules:
- only one disk may be moved at a time
- a larger disk may not be placed on top of a smaller one.

The puzzle was invented by French mathematician Édouard Lucas in the 1880s. He claimed the puzzle is based on an ancient Hindu legend. According to this story, when the world was created, the Hindu god Brahma gave three diamond rods to the priests of a temple and ordered them to put 64 golden disks in ascending order on one of these rods. Each morning, the high priest has to put one of the disks on another rod, while paying attention not to put a larger disk on a smaller one.

As long as the priests obey the rules, people can live in peace on Earth. However, if they violate the rules, by not moving a disk every day or putting a larger disk on a smaller one, then the god of death, Yama, will destroy the world.

In one version of the legend, the temple is situated in Vietnam, in the city of Hanoi, hence the name 'Tower of Hanoi'. However, it was perhaps Lucas who made up the entire 'legend' as a background story for his puzzle.

The main question of the Tower of Hanoi puzzle is the following: How many moves are needed to move the entire stack of disks from the first rod to the last one, without violating the rules?

The minimum number of moves needed to solve the puzzle can be determined relatively quickly and easily using recursion. (It is only possible to move the largest disk from the first rod to the third one if the other disks have been put on the second rod.) In case of n disks, we need a minimum of 2ⁿ – 1 moves to place the entire stack of disks on the third rod obeying the rules (where n is a positive whole number).

According to the legend, when the last move of the puzzle is completed, the world will end. But there is nothing to worry about, as to relocate the tower of 64 disks, 18,446,744,073,709,551,615 (2⁶⁴ – 1) days, in other words, 50 thousand trillion years are needed, and this is 10 times more than the Sun's estimated life expectancy.

Best of luck to all the Brahmin priests!

Automatic solution

Algorithm to solve the puzzle

Robotic arm

  • arm
  • wrist
  • link arm
  • rotating column
  • base frame

Related items

3D Tangram

A special, 3D version of the well-known Chinese logical game.

Soma cube

Three-dimensional assembly puzzle with solutions.

Chess games

Chess games can help to develop logic skills.

3D puzzle

This exciting and colorful game is designed to develop spatial perception. You can check your solutions using isometric views.

Scale exercises

An interesting logical exercise: you have many weights that look the same, you have to find the only one that is different.

Shape games

Find views and nets of three-dimensional shapes.

Added to your cart.