D10. Half-and-half Hanoi

Contributed by Andreas Hinz, LMU München

You may be familiar with the Tower of Hanoi puzzle in which you start with eight discs stacked on one of three pegs, each disc smaller than the one below it. The other two pegs are empty. The goal of the puzzle is to move the entire stack of discs to a different peg, according to the following rules:

  1. Only one disc may be moved at a time, from the top position on one peg to the top position of a different peg.
  2. No disc may ever be placed on top of a smaller one.

For convenience, we number the discs from 1 to 8 in order from smallest to largest. In this variation, you start with discs 1, 3, 5, and 7 on the first peg, and discs 2, 4, 6, and 8 on the second peg, as shown in Figure 1. Your goal is to end up with all eight discs in order on the third peg, following both rules (a) and (b). What’s the fewest number of moves needed to accomplish this goal, and how do you do it? How do you know your solution is minimal?

Figure 1: The starting position for Half-and-half Hanoi.

This problem originally appeared in the Prisoner’s Dilemma in the 2023 Spring issue of the PMP Newsletter. Solutions are no longer being accepted for this Dilemma.

Show solution?  
Solution.

The Prisoner’s Dilemma received solutions from PMP participants William Keehn and Robert Noll; we follow primarily the former. First show that the minimum number of moves to solve the usual Tower of Hanoi puzzle with n discs is H n = 2 n 1 , by breaking the problem into shifting the top n 1 discs (using H n 1 moves), followed by moving the n th disc, followed by shifting the n 1 smaller discs back on top of it (using another H n 1 moves). You can then solve the resulting recurrence relation H n = 2 H n 1 + 1 .

Figure 2: Segregating Hanoi discs by parity.

Now consider the problem Prof. Hinz poses. Note that every move is reversible, so if you were to play a film of the optimal solution backward, it would necessarily be the optimal way to turn a pile of eight discs into the configuration shown in Figure 1. But to accomplish this task, you must first use H 7 moves to shift the top discs, one move of disc 8, H 5 moves to uncover disc 6, one move to put 6 on top of 8, H 4 moves to uncover disc 5 and one more to put it on 7, H 2 moves to uncover disc 3 and one more to put it on disc 5, and two final moves to put disc 1 on 3 and disc 2 on 4. (This sequence of events is beautifully depicted in William’s drawing shown in Figure 2.) Using the formula for H n , these phases total 182 moves, the minimum possible.