Game Guide

Tower of Hanoi: Master the Classic Puzzle for Brain Training [2026]

Learn the Tower of Hanoi puzzle, its mathematical elegance, and cognitive benefits. Discover strategies to solve it optimally and train your planning skills online for free.

Reading time: ~8 min

What is the Tower of Hanoi?

The Tower of Hanoi is one of the most famous mathematical puzzles in history. It consists of three pegs and a set of disks of different sizes that can slide onto any peg. The puzzle starts with all disks stacked on one peg in order of size, with the smallest on top.

The objective is simple: move the entire stack to another peg, following these rules:

  1. Only one disk may be moved at a time
  2. Each move takes the top disk from one peg and places it on another peg
  3. A larger disk may never be placed on top of a smaller disk

Historical Background

The Legend of the Temple

French mathematician Edouard Lucas invented this puzzle in 1883. He published it under the pseudonym "N. Claus de Siam" (an anagram of "Lucas d'Amiens") with a fictional origin story: monks in a temple must move 64 golden disks according to the rules, and when they finish, the world will end.

With 64 disks requiring 2^64 - 1 moves (approximately 18.4 quintillion moves), even at one move per second, this would take about 585 billion years - far longer than the age of the universe!

Mathematical Significance

The Tower of Hanoi is a classic example of recursion in computer science and mathematics. The recursive solution demonstrates how complex problems can be broken down into simpler subproblems:

  • To move n disks from A to C: First move n-1 disks from A to B, move the largest disk from A to C, then move n-1 disks from B to C

This elegant solution has made the puzzle a fundamental teaching tool in computer science education.

Scientific Background

Executive Function Research

The Tower of Hanoi has been widely used in cognitive psychology and neuroscience research since the 1980s. Studies have shown that performance on the Tower of Hanoi correlates with frontal lobe function and is often used to assess executive function.

Research Context

The Tower of Hanoi is frequently used in neuropsychological assessments to evaluate planning ability, problem-solving, and cognitive flexibility. It has been studied in various populations including patients with frontal lobe damage, Parkinson's disease, and ADHD.

Cognitive Abilities Measured

Planning Ability

The ability to think ahead and formulate a sequence of moves before acting. Essential for goal-directed behavior.

Problem Decomposition

Breaking down a complex problem into smaller, manageable subproblems. A fundamental skill in problem-solving.

Working Memory

Holding the current state and planned moves in mind while executing the solution.

Inhibitory Control

Resisting the temptation to make obvious but suboptimal moves, and following the optimal strategy.

How to Play

  1. Start the Puzzle

    Click "Start" to begin. You'll start with 3 disks on peg A. Your goal is to move all disks to peg C.

  2. Select a Disk

    Tap a peg to select the top disk. The selected disk will be highlighted. You can only move the topmost disk on any peg.

  3. Move the Disk

    Tap another peg to move the selected disk there. Remember: you cannot place a larger disk on a smaller one!

  4. Complete and Level Up

    Move all disks to peg C to complete the level. Try to do it in the optimal number of moves! Successfully completing a level advances you to the next with one more disk.

Optimal Moves Guide

DisksOptimal MovesFormula
372^3 - 1
4152^4 - 1
5312^5 - 1
6632^6 - 1
71272^7 - 1

The pattern follows the formula 2^n - 1, where n is the number of disks. Each additional disk more than doubles the required moves.

Training Benefits

Regular Tower of Hanoi practice may provide the following benefits:

  • Enhanced Planning Skills: Training yourself to think multiple steps ahead can improve planning ability in daily life
  • Better Problem Decomposition: Learning to break complex problems into simpler parts is a transferable skill
  • Improved Working Memory: Holding the solution strategy in mind while executing exercises working memory
  • Increased Patience: The puzzle rewards careful, deliberate thinking over impulsive actions

Note: Effects vary between individuals. Not everyone will experience the same benefits.

Tips and Strategies

The Alternating Strategy

The most elegant solution uses a simple alternating pattern:

  1. Move the smallest disk in a consistent direction:

    • For odd number of disks: clockwise (A → B → C → A)
    • For even number of disks: counter-clockwise (A → C → B → A)
  2. Make the only other legal move (not involving the smallest disk)

  3. Repeat until solved

Recursive Thinking

Understanding the recursive nature helps:

  1. To move n disks from A to C:
    • Move top n-1 disks from A to B (using C as helper)
    • Move the largest disk from A to C
    • Move n-1 disks from B to C (using A as helper)

Common Mistakes to Avoid

  • Rushing: Taking time to plan leads to better solutions
  • Ignoring the pattern: Once you learn the alternating strategy, trust it
  • Forgetting the goal: Always keep the final destination (peg C) in mind

Comparing Problem-Solving Tasks

FeatureTower of HanoiTrail Making TestTask Switching
Primary SkillPlanningProcessing SpeedCognitive Flexibility
Time PressureModerateHighHigh
Solution TypeSequentialVisual SearchRule Switching
Session Length2-5 minutes1-2 minutes3-5 minutes

Tower of Hanoi uniquely emphasizes sequential planning and requires maintaining a strategy over multiple moves.

Combining with Dual N-Back

Tower of Hanoi and Dual N-Back train different but complementary cognitive skills:

  • Tower of Hanoi: Planning, problem decomposition, sequential thinking
  • Dual N-Back: Working memory updating, divided attention

Practicing both can provide comprehensive cognitive training, targeting both strategic thinking and memory updating abilities.

Related Articles:

FAQ

Q:

A:

Conclusion

The Tower of Hanoi is more than just a puzzle - it's a window into how we plan, strategize, and solve problems. Invented over 140 years ago, it remains relevant today as both a cognitive training tool and a teaching example in computer science.

Whether you're looking to sharpen your planning skills, learn about recursive thinking, or simply enjoy a satisfying puzzle, the Tower of Hanoi offers a rewarding challenge. Start with 3 disks, master the alternating strategy, and work your way up!

Related Articles

Start Training Your Brain Today

Experience scientifically-proven cognitive training with our free app