Saturday 22 February 2020

A brilliant solution to the Tower of Hanoi

I have always underestimated the interest value of the Tower of Hanoi problem.  If you don;t remember the puzzle, there are three positions for piles of discs of different sizes, starting with all discs piled from smallest to largest on one pile (in this case the leftmost).
The Tower of Hanoi
The problem is to move disks so that the whole pile is now in the rightmost position, but one can only move one disc at a time and one can never place a larger disc on top of a smaller one.

The surprise is how many moves are necessary - to move a pile of n discs takes 2^(n-1) operations.  (it's a good example showing various ideas about algorithms, such as recursion.)  There is a legend that monks in India are engaged in moving a tower of 64 discs, one operation per day, and that when the move is complete, the world will end.  How long would that take?

Although I won a T-shirt by solving the puzzle in Lewisham Shopping Centre on a Saturday morning in Maths Year 2000, I had never felt that the puzzle has mass appeal: the procedure for solution is too laborious.  But recently I took the puzzle in the photograph to the Green STEM Fest for children at the University of Greenwich (along with things which I thought were more likely to attract interest) and this was the exhibit the kids enjoyed most.  A few nine-year-olds (or so) started racing each other against the clock, recording times of around 35 seconds, which seemed pretty quick to me.

Then one of them produced the brilliant solution in the video below (which is a reconstruction)!  This is the work of a real mathematician who has recognised the symmetry in the situation.