TITLE: Mathematical model for Hanoi Towers
QUESTION [13 upvotes]: The strategy for the Hanoi Tower puzzle is quite simple. It is based on parity only. In an $n$-pieces puzzle, $2^n-1$ moves are sufficient to carry the whole pile from one pole to another one. My question is

Is there any mathematical (algebraic, logical, ...) structure associated with the Hanoi Tower puzzle? Does the optimal strategy translate into some mathematical result about this structure?

REPLY [2 votes]: The fundamental group of the Menger Cube is an uncountable locally free and residually free group that contains the fundamental groups of all one-dimensional separable metric spaces as subgroups. It is known to frighten children and mathematicians alike. One can work within this group using a reduced path calculus; however, there is also an interesting word calculus (due to Hanspeter Fischer and Andreas Zastrow) that can be framed in terms of a variation of the Towers of Hanoi game. This is possible because the Menger cube may be realized as the inverse limit of finite groups each of which is the state-graph $X_n$ of a variation of the classical game using $n+1$ two-sided disks.
Hanspeter even created an ipad app that allows the user to move around within the approximating graphs $X_2$ (image below) while seeing the game state at the same time. It had dramatic whooshing and ringing sounds so naturally I spent too much time playing around with it.

Hanspeter Fischer, Andreas Zastrow, Word calculus in the fundamental group of the Menger curve, Fundamenta Mathematicae 235 (2016) 199-226. https://arxiv.org/abs/1310.7968
From the introduction of the cited paper regarding the details of the variation:

In our version of the Towers of Hanoi, the placement of the disks is restricted to within the well-known unique shortest solution of
  the classical puzzle, while we allow for backtracking within this solution and for the
  turning over of any disk that is in transition. We color the disks white on one side
  and black on the other. Then the state graph of this new “puzzle” is isomorphic
  to $X_n$, with edges corresponding to situations where all disks are on the board
  and vertices marking the moments when disks are in transition. The exponents of
  the edge labels ($x^{\pm 1}$ or $y^{\pm 1}$) indicate progress (“$+1$”) or regress (“$−1$”) in solving the classical puzzle (we add a game reset move when the classical puzzle is solved) and their base letters indicate whether the two disks to be lifted at the respective vertices of this edge are of matching (“$x$”) or mismatching (“$y$”) color. Hence, each edge-path through $X_n$ corresponds to a specific evolution of this game, as recorded by an observer of the movements of the $n + 1$ disks.
Our word calculus can be modeled by aligning an entire sequence of
  such puzzles with incrementally more disks into an inverse system,
  whose bonding functions between individual games simply consist of
  ignoring the smallest disk. Subsequently, every combinatorial notion
  featured in the description of the generalized Cayley graph has a
  mechanical interpretation in terms of this sequence of puzzles