Wolfram Library Archive

All Collections Articles Books Conference Proceedings
Courseware Demos MathSource Technical Notes
Title Downloads

Generalized Hanoi Tower

Jaime Rangel-Mondragón
Organization: Universidad Autonoma de Querétaro
Department: Facultad de Informatica
Revision date


The problem of the tower of Hanoi has become a classic one appearing in most introductory courses on algorithm analysis and design. In its full generality it considers a tower of disks of decreasing size (the largest one at the bottom) being stacked initially in a peg. Other pegs are provided so that they can be used in following certain rules aimed at transferring the tower from its initial peg to a different one. The rules establish that a disk has to be moved in such a way that it is transferred on top of a bigger disk or to an empty peg. So, by moving one disk at a time, the question arises as to how to transfer the initial tower in the least number of steps. This work includes a solution of the general version of the Tower of Hanoi, along with animations.

*Applied Mathematics > Computer Science
*Mathematics > Discrete Mathematics
*Mathematics > Recreational Mathematics

Hanoi Tower


HanoiTower.zip (14.4 KB) - Generalized Tower of Hanoi notebook, zipped