The Tower of Hanoi with 4 pegs instead of 3 was only completely solved in 2018. The word “solved” here means to find a closed expression for Wₙ, the minimum number of moves necessary to transfer a tower of n discs between two pegs, using two auxiliary pegs, under the usual Tower of Hanoi rules. It is easy to prove that
where Tₙ=2ⁿ-1 is the number of moves necessary to solve a 3-peg Tower of Hanoi. In 1941, an algorithm was independently devised by mathematicians J.S. Frame and B.M Stewart, which consists on transferring first a triangular number of discs to a peg, then moving the largest remaining disks without altering that secondary tower, then moving the initial tower again, which gives the expression above. The bound is indeed optimal, so the expression is actually an equality, but this was not completely proven until Roberto Demontis found a proof in 2018. The problem had eluded solution for more than a century.
The generalized Tower of Hanoi with any number of auxiliary pegs can be solved optimally this way: If Zₖ(n) is the minimum number of moves necessary to transfer n discs with k pegs, we have
where the quantities between brackets are the binomial coefficients
This means, for example, that a Tower of Hanoi problem with 4 pegs and n(n+1)/2 discs can be solved in exactly 2ⁿ(n-1)+1 moves. In particular, a problem with 6 discs and 4 pegs can be solved in 17 moves.