Tower of Hanoi - First Move

196 Views Asked by At

I know the minimum moves the Tower of Hanoi can generate is 2^n - 1 given n pegs. Suppose we have 3 positions, A, B and C and all pegs start from A and the goal is to move the pegs from A to C and no peg is smaller than the one under.

In the Python and Java code online, it seems when n is odd, the first peg is moved to C and when n is even, the first peg is moved to B.

Does anyone know it is the case? Why not when n is odd, move first peg to B instead?

Thanks!