Towers of Hanoi


Legend has it that the monks at a monastery in old Hanoi spent their days moving a set of rings from one peg to another via a third intermediate peg. There were 64 rings altogether, and at no time was a larger ring permitted to cover a smaller one. The legend also claimed that the world would end when the monks had finished their task. Fortunately for us one can demonstrate mathematically that for a set of n rings the number of moves required is 2n-1. For a set of 64 rings this number computes to 1.844 x 1019. Even if the monks had been able to move one ring per second, and never made a mistake, their task would still have taken them 5.85 x 1011 years. Try it yourself - the rings can be moved with the mouse. To see a demonstration of the solution click the button below.

Javascripts Page | Home