<img alt="" src="brahma.gif" width="272" height="200" border="0">

The Tower of Brahma

At the great temple of Benares, there is a brass plate on which 3 vertical diamond shafts are fixed. On the shafts are mounted 64 golden disks of decreasing size. At the time of creation, the god Brahma placed all of the disks on one pin, in order of size with the largest at the bottom. The Hindu priests unceasingly transfer the disks from peg to peg, one at a time, never placing a larger disk on a smaller one. When all of the disks have been transferred to the last pin, the universe will end.

The priests at Benares require 264 - 1 moves to complete their task. Given 1 move a second, it will take some 600,000,000,000 years to transfer all the disks.

The 5 disk puzzle does not take quite so long. The Tower of Brahma is a classic programmer's problem that is often used to illustrate the power of recursion.