Return to main page

Towers of Hanoi

p p p
- - -
- - -
- - -
- - -
- - -
- - -
- - -
- - -
- - -
- - -
- - -
- - -
Discs: Mode: Move:
0 of 127

What is "The Towers of Hanoi"?

It is a puzzle where the object is to move all of the rings to the right most peg. You may only move one ring at a time and you must never allow a larger ring to rest on a smaller ring.

How To Use This Version

This is an electronic version of the puzzle. When you have chosen how many discs you want you must choose which course of action you want. You can either have the solved by the computer or you can solve it yourself by choosing one of the following modes:

  • User: You move the blocks, but the computer stops you from cheating
  • Teacher:You move but you are alerted if you do a wrong move
  • Cheat:You can do all moves, including illigal ones
  • Solve quickly:Your computer solves the puzzle quickly
  • Solve normally:Your computer solves the puzzle at normal speed
  • Solve slowly:Your computer solves the puzzle slowly

To move the discs simply use the buttons right under the pegs. If you want the computer to solve it simply press start after choosing speed. If at start there is a disc at the middle peg your browser is unluckily incompatible. I have tested it to work on the following browsers: Firefox, Internet explorer 6 for windows, Safari, Mozilla and Camino.

The History of The Towers of Hanoi

There is a legend about the puzzle and it goes as follows: In the temple of Benares, at the center of the world, there were three diamond poles on a copper plate. During the Creation God placed 64 golden disks on one of these poles and they were stacked from large to small. This is the Tower of Brahma, but is also called the tower of Hanoi. The priests are then to move one disc at a time, putting it on one of the other poles, and never place it onto a smaller disc.

When the tower has been transferred from to the other pole, the world would cease to exist. But don't panic! In order to transfer the 64 disks properly a total of 18,446,744,073,709,551,615 moves are required if you make absolutely no mistakes. If you work very quickly and moved, say one disc every second of every hour of every day, it will take over 580,000,000,000 (=580 billion) years to solve, so the sun will explode before that happens! Well… actually the Tower of Hanoi was actually invented in 1883 by the Edouard Lucas (a French mathematician).

The Math Behind The Towers of Hanoi

To move all discs from one pin to another takes 2D-1 moves where "D" is the number of discs. Therefore the number of discs moves is approximately doubled every time you put another one on it. The following table shows the coherence between the number of discs and the number of moves:

Discs Moves

Contact & Copyright  |  validate: xhtml 1.0 css 2