The Tower of Hanoi has one simple rule: move the whole tower to another peg, one disc at a time, and never put a larger disc on a smaller one. Solve it by hand first, then watch a computer solve it with recursion, a method in which a problem is solved by solving a smaller copy of itself, and see the computer's call stack grow and shrink as it works.

This article and its interactive demo were created with the help of generative AI and editorially reviewed.