Brain Science

MyRin Tower of Hanoi: The Recursive Puzzle That Reveals How Your

Tower of Hanoi is one of the most studied puzzles in cognitive science. It's also one of the most misunderstood.

The Tower of Hanoi was invented by French mathematician Édouard Lucas in 1883. He gave it a mythological framing: a tower of 64 golden disks in a temple in Hanoi, moved by monks one disk at a time according to the puzzle's rules. When the transfer is complete, the world ends. At the optimal rate of one move per second, this would take 585 billion years, roughly 42 times the current age of the universe.

The puzzle's longevity in cognitive science is not due to its mythology. It's due to its unique property as a test of hierarchical planning: the ability to break a complex goal into sub-goals, and sub-goals into sub-sub-goals, in advance of any action. This capacity is one of the clearest expressions of frontal lobe function, and it predicts performance on a wide range of demanding cognitive tasks.

Tower of Hanoi
A puzzle with three pegs and a stack of disks of decreasing size. All disks start on the leftmost peg. The goal is to move the entire stack to the rightmost peg, moving one disk at a time, never placing a larger disk on a smaller one.

The recursive solution: one insight that handles everything

Most players approach Tower of Hanoi by trial and error, building local intuition through repeated attempts. This works for 2 and 3 disks. It breaks down at 4 and above, where the number of possible move sequences becomes large enough to exceed working memory.

The correct approach is recursive. Here is the insight:

To move n disks from peg A to peg C (using peg B as auxiliary): move the top n−1 disks from A to B, then move the bottom disk from A to C, then move the n−1 disks from B to C.

That's the entire algorithm. It reduces any n-disk problem to a sequence of (n−1)-disk problems, which reduce to (n−2)-disk problems, all the way down to the 1-disk base case (move one disk directly from source to destination).

What makes this insight difficult for most people is that it requires accepting sub-goals that appear to move away from the final goal. To solve a 4-disk puzzle, you must first move 3 disks to the middle peg, which looks like you're undoing progress. The recursive mind accepts this; the non-recursive mind resists it and tries to find a shortcut that doesn't exist.

The minimum number of moves

The minimum number of moves to solve an n-disk Tower of Hanoi is always 2ⁿ − 1:

  • 2 disks: 3 moves
  • 3 disks: 7 moves
  • 4 disks: 15 moves
  • 5 disks: 31 moves
  • 6 disks: 63 moves

Each additional disk exactly doubles the number of required moves, plus one. This exponential growth is why MyRin's highest difficulty levels feel qualitatively harder, not just incrementally harder. A 6-disk puzzle requires nine times as many moves as a 3-disk puzzle, but the recursive strategy applies identically to both.

What Tower of Hanoi measures in cognitive research

Tower of Hanoi was introduced to neuropsychological assessment in the 1970s. It has since been used in thousands of studies examining:

  • Frontal lobe function: patients with frontal lobe damage consistently perform poorly on Hanoi relative to other cognitive tasks, even when their general intelligence and memory are intact
  • Working memory capacity: the ability to hold the recursive sub-goal structure in mind while executing moves requires substantial working memory
  • Cognitive aging: Hanoi performance declines earlier and more steeply with age than other puzzle types, making it a sensitive indicator of frontal aging
  • Psychiatric conditions: OCD, ADHD, and schizophrenia all show characteristic Tower of Hanoi performance profiles

The puzzle's diagnostic sensitivity comes from the fact that it specifically demands planning, not memory, not processing speed, not general reasoning, but the hierarchical planning process of decomposing a goal into ordered sub-goals. This process is specifically fragile and specifically trainable.

How to practice Tower of Hanoi effectively

Internalize the recursive rule before attempting larger puzzles. Solve 2-disk and 3-disk versions while narrating the recursive logic aloud: "I need to move the top 2 disks to the middle peg first. To do that, I need to move the top 1 disk to the right peg first." This verbal articulation of the sub-goal structure is not just pedagogically useful, it helps encode the hierarchical planning pattern in a way that transfers to 4 and 5-disk versions.

Count your moves. If you're using more than 2ⁿ − 1 moves, you've deviated from the optimal path. Restart from the deviation point rather than correcting forward, correcting forward typically requires additional sub-optimal moves. Developing a sensitivity to optimal vs. non-optimal moves is itself a form of planning practice.

Don't rush the decision at each step. Tower of Hanoi performance under time pressure looks similar to working-memory-depleted performance, people make more errors, take longer overall, and use more moves than the minimum. The puzzle rewards deliberate decision-making at each step over rapid trial-and-error.

The broader transfer

Hierarchical planning, the cognitive process that Tower of Hanoi trains, appears in any situation requiring the decomposition of a complex goal into ordered steps. Writing a long document, debugging software, planning a project, preparing for a negotiation: all of these require the same type of sub-goal management that the Tower makes visible and trainable.

The cleaner your Tower of Hanoi thinking becomes, the more naturally you decompose "move all disks" into "move top n−1 disks, then move bottom disk, then move n−1 disks again", the more naturally you apply the same decomposition pattern in domains where the sub-goals are less clearly defined. This is cognitive transfer in its most direct form.