---
title: "Tower of Hanoi & Tower of London Explained: Recursive 2ⁿ − 1 Algorithm (+ Live Lab)"
canonical: "https://pencilvsfeedback.com/pt/guides/tower-of-hanoi-and-tower-of-london-executive-planning-explained"
locale: "pt-BR"
type: "Article"
keywords: ["tower of hanoi online free 5 disks", "how to solve tower of hanoi 31 moves", "tower of london executive function planning", "2^n - 1 tower of hanoi proof"]
videoUrl: "https://pencilvsfeedback.com/pt/shorts/put-the-train-in-order-puzzle"
---

# Tower of Hanoi Executive Planning: How to Solve 5 Disks in Exactly 31 Optimal Moves

## Direct Answer
Invented by mathematician Édouard Lucas (1883) and adapted into clinical neuropsychology via Tim Shallice's (1982) Tower of London test, disk-transfer puzzles measure prefrontal lookahead and hierarchical subgoal planning. Solving n disks optimally requires exactly 2ⁿ − 1 moves (15 for 4 disks, 31 for 5 disks, 63 for 6 disks). Healthy adults average 65%–86% efficiency on 5 disks—test your live planning efficiency below or at pencilvsfeedback.com/tower-test!

## Key Facts
- **Mathematical Optimum:** 2ⁿ − 1 moves (4 disks = 15 · 5 disks = 31 · 6 disks = 63)
- **Typical Adult Efficiency:** 65%–86% (36–48 moves on 5-disk benchmark)
- **Prefrontal Skill Tested:** Subgoal decomposition, working-memory lookahead & inhibition
- **Cyclic Shortcut:** Move Disk #1 every odd turn in ONE steady direction!

## The Foolproof 2-Rule Iterative Algorithm for 100.0% Efficiency
1. **Odd moves (1, 3, 5...): Always move Disk #1 in ONE fixed direction:** For odd towers (5 disks), cycle Disk #1 Peg 1 → Peg 3 → Peg 2 → Peg 1. For even towers (4 or 6 disks), cycle Peg 1 → Peg 2 → Peg 3 → Peg 1!
2. **Even moves (2, 4, 6...): Make the ONLY legal move NOT involving Disk #1:** Surprisingly, once Disk #1 isn't touched, there is always exactly ONE legal move between the other two pegs!
3. **Use keys 1 / 2 / 3 to execute 31 moves in under 25 seconds:** Keyboard peg selection turns recursive mastery into a silky rhythm speedrun.

## Why Computer Scientists & Neuropsychologists Both Love Tower of Hanoi
To move a 5-disk pyramid to Peg 3, you MUST first move the top 4 disks onto Peg 2, shift Disk #5 to Peg 3, and then rebuild those 4 disks atop Disk #5. That exact nested 'subgoal-inside-subgoal' stack mirrors both computer call stacks and dorsolateral prefrontal executive planning!

## Frequently Asked Questions
### Does the 2-rule cyclic method ALWAYS guarantee the exact 2ⁿ − 1 minimum moves?
Yes! Mathematically, cycling Disk #1 consistently every odd turn and taking the sole legal non-Disk-1 move every even turn traces the unique shortest path in the Tower of Hanoi state graph with zero wasted moves!

