Classic disc-moving puzzle game
Move all discs from the left peg to the right peg. You can only move one disc at a time, and a larger disc cannot be placed on a smaller one. Click a disc to select it, then click a peg to move it there.
For n discs, the minimum moves are 2^n - 1. That's 7 for 3 discs, 15 for 4, 31 for 5, 63 for 6, and 127 for 7. It's mathematically impossible to solve in fewer moves.
Recursive thinking is key. To move n discs: (1) move top n-1 to auxiliary peg, (2) move the largest to target peg, (3) move n-1 to target peg. For odd discs, first move the smallest to the right; for even, to the middle.
Invented by French mathematician Edouard Lucas in 1883. Legend says monks in a temple in Benares are moving 64 gold discs, and the world ends when they finish. The minimum moves for 64 discs is about 18.4 quintillion, taking roughly 585 billion years at one move per second.
Tower of Hanoi is a classic example of recursion algorithms, widely used in computer science education. It helps intuitively understand recursive thinking, divide-and-conquer strategy, and time complexity (O(2^n)).
The Tower of Hanoi is a classic mathematical puzzle invented by French mathematician Edouard Lucas in 1883. It consists of three pegs and discs of different sizes. The goal is to move all discs to another peg following the rules: only one disc at a time, and no larger disc on a smaller one. Supports 3 to 8 discs with auto-solve and undo features. A classic recursion example used in computer science education. Develops logical thinking and problem-solving skills. Play free online in your browser.