[Math] How to one solve the tower of hanoi problem if there are discs of similar width in it

puzzlerecreational-mathematicsrecursion

For example a line with '1111' represents a disc with diameter of length 4. Similarly a line with '111' represents a disc with diameter of length 3.

Below is the representation of a tower that has 5 discs. ground disc has a diameter 9, disc '2' d=5, disc '3 and 4' d=3 and disc '4' has d = 1.

$1$

$111$

$111$

$ 11111$

$111111111$

How Many moves will it take to move these kind of towers?

Best Answer

If you have two equal disks, then as long as they're on different pegs, you can't ever move any larger disk. So it makes no sense to stay in this situation longer than necessary. The optimal solution must therefore be to keep all disks of the same size together, only splitting them up temporarily when you need to move all of them from one peg to another, which then needs to happen one at a time.

This reduces the problem to the usual Towers of Hanoi problem with one disk per size class. You just need to multiply the number of moves each disk makes in the standard problem (namely $2^n$ where $n$ is the number of larger sizes) by the number of disks of a given size, and then add everything together.

Related Question