The Axiom Blog

What 21 Coins Taught Me About Game Theory

Dr. Revi Panidha · 31 October 2026

There is a particular moment in a game theory classroom that I have always enjoyed. Twenty-five exceptionally able students are divided into five teams. I put 21 coins on the table, explain three simple rules, and announce a small prize. Almost immediately, the room fills with discussion. Students begin to count, argue, test ideas and defend strategies. They are doing precisely what I want them to do: thinking strategically rather than simply listening to me talking about strategy.

When I taught microeconomics-based courses at the London School of Economics, including MG207, this was one of my favourite exercises. It rarely required more preparation than remembering to bring the coins. After a competition among the student teams, the winning team would eventually face me in a final round, with £5 at stake. The team could choose whether to play first or second. The money was never really the point, although it made the competition more entertaining. What interested me was how rarely anyone managed to take it home, despite having watched at least three rounds of play.

The students were bright, engaged and already studying formal game theory. Yet a game with a simple solution could remain elusive, especially when everyone was concentrating on winning. That gap between knowing a principle and recognising when to use it is one of the most interesting problems in teaching economics.

Twenty-one coins, five teams and one small prize

The rules were straightforward. Start with 21 coins. Two players (or teams) alternate turns. On each turn, a player removes one, two or three coins. The player who takes the final coin wins. I would give the five groups some time to discuss a strategy before arranging a small tournament, keeping track of the winners as teams played one another. Finally, one surviving team would play against me.

Often a student would say, “The first few moves are not important,” or “Let us see how the opening goes.” Several students reported having played similar games involving more than two players, where a comparable forcing strategy might not exist. But here, with two players and these rules, the first player can guarantee victory.

Students would sometimes work hard on what to do near the end of the game, without tracing that reasoning back to the very first move.

What experiments tell us about strategic insight

One particularly relevant study is Dufwenberg, Sundaram and Butler (2010), “Epiphany in the Game of 21”, published in the Journal of Economic Behavior & Organization. Its question is beautifully simple: does a person play better when it occurs to them that a game might have a discoverable, systematic solution?

There is an important distinction between their game and mine. Their game involves counting up to 21, adding either one or two on each turn. That makes multiples of three crucial and gives the second player the winning strategy. My classroom version starts at 21 and removes one, two or three, so multiples of four are crucial and the first player has the advantage. These are close relatives, not identical mathematical games.

In the researchers’ results, the player with the winning position played perfectly in only 27% of the longer-game rounds, compared with 93% in a shorter version of the game, where the optimal strategy was easier to see. They used a shorter “game of six” to explore whether solving an easier game helped players recognise the structure of the longer one. They called the realisation that a reliable strategy might exist an epiphany, distinguishing it from actually discovering that strategy. Their findings underline how small problems can illuminate large ones.

This is also consistent with what I have observed in teaching: sometimes the most important intervention is not to disclose the strategy, but simply to say that a strategy exists. The assertion changes how students allocate their attention. They stop treating the next move as an isolated choice and begin searching for an invariant—a feature of the position that they can preserve regardless of the opponent’s move.

A small classroom experiment anyone can run

A teacher could turn this into a classroom experiment. Randomly divide students into two groups, without communication during play. Give the first group only the rules. Give the second the same rules, adding: “There is a strategy which guarantees victory from the correct starting position.” Tell neither group the strategy itself.

Record who chooses first, opening moves, wins and explanations. Compare the proportions who identify the correct opening and a response that works against any opponent. Keep thinking time identical and, ideally, use an opponent who plays consistently.

Did being told that a solution existed change mathematical ability—or simply the willingness to search for a pattern?

An old game with a surprisingly modern life

Nim belongs to a much older family of take-away games. Its precise origins are uncertain. Historians have associated related forms with ancient Chinese play, while ETH Zurich’s library notes references to comparable games in Europe as early as the sixteenth century. So variants were being played well before the eighteenth century, even though it would be misleading to claim a single, well-documented date or place of invention.

The decisive mathematical advance came much later. In 1901–02, Harvard mathematician Charles Leonard Bouton published “Nim, a Game with a Complete Mathematical Theory”. The title captures the charm of the subject. A game that appears to invite endless trial and error can actually be solved systematically. Bouton’s general solution uses the binary representation of the piles and a calculation now known as the nim-sum.

During the 1930s, work by Roland Sprague and Patrick Grundy helped show how the mathematical structure of Nim could illuminate a much wider class of two-player games. Then Nim acquired an unexpected place in computing history. The Nimatron demonstrated an electromechanical Nim-playing machine at the 1939–40 New York World’s Fair. In 1951, Ferranti displayed Nimrod at the Festival of Britain, allowing visitors to challenge a machine whose moves were determined by mathematics.

Try the 21-stick challenge

I have turned my classroom’s 21 coins into the interactive stick game below. Choose to play first or second. You may take one, two or three sticks at a time; the last stick wins. The Axiom tutor on the other side plays optimally. My suggestion is to try at least once before looking at the explanation again. Can you discover the winning strategy independently?

Why backward induction changes everything

The central idea is backward induction: solve the end first, then reason towards the beginning. A large maze can seem daunting from its entrance; the route sometimes becomes clearer if we start at the exit. A sequential game can be approached in much the same way.

Imagine that there are only four coins left and it is your turn. You may take one, two or three, but you cannot take all four. Whatever you choose, a perfectly attentive opponent takes the remainder and wins. Thus four is a losing position for the player about to move. Not because of bad luck, but because no legal action can avoid defeat against perfect play.

Now add one coin. With five left, you take one, leaving your opponent four. With six, you take two. With seven, you take three. In each case you pass the losing four-coin position to your opponent. And with eight coins? Every legal move leaves five, six or seven, each of which gives the next player a way back to four. So eight, too, is losing.

Continue backwards: 12, 16 and 20 are losing positions for whoever must move next. This gives a complete strategy for 21 coins. Take one on your opening move and leave 20. Afterwards, whatever your opponent takes, you take enough to make the two moves add to four. If they take one, you take three. If they take two, you take two. If they take three, you take one. The game moves through 16, 12, 8 and 4 until you take the final coin.

The Oxford interview variation: seven rows of three

A small change in Nim’s rules can create a new intellectual challenge. When interviewing Philosophy, Politics and Economics candidates at Oxford, I have used related games to see how someone approaches an unfamiliar problem, tests a conjecture and responds to a hint. I was interested in reasoning, not prior knowledge of Nim games.

Here is one of those variations. Begin with 21 sticks arranged in seven rows of three. On every turn, you may take one, two or three sticks, but they must all come from the same row. You may choose any row, and there is no required order. As before, the player who takes the very last stick, wherever it happens to be, wins.

In the single-line game, the total remaining tells you everything necessary. Here, the distribution matters: seven sticks in one pile differ strategically from seven spread across several piles. The challenge is to identify equivalent positions rather than equal totals.

Try the seven-row challenge

Choose first or second, then tap a row to select it and choose how many sticks to remove from that row. The Axiom tutor again plays optimally. Try to win before reading the following section; if possible, explain not just what opening move you favour but why your response would work against every subsequent move.

Start with two rows, not seven

If seven rows seem difficult, reduce the problem. Imagine that only two rows remain, each containing three sticks. The diagram below shows that smaller position. Ask yourself: would you prefer to be the person who moves next, or the person waiting for that move?

Suppose you must move first. You have only three kinds of move: remove one, remove two or remove all three sticks from a row. If you remove all three, your opponent removes the other three and wins. If you remove two, the position becomes one stick in one row and three in the other. Your opponent can remove two from the longer row, giving you two identical rows containing one stick each. From there, whichever stick you take, your opponent takes the last one.

What if you remove just one? Your opponent can remove one from the other row, leaving two rows of two. If you now remove both sticks from one row, the opponent removes both from the other and wins. If you remove one, the opponent can remove one from the other row, producing two rows of one—and you lose for the same reason as before.

This is backward induction again, but now the useful feature is not a multiple of four. It is symmetry. Two identical rows form a losing position for the player whose turn it is, provided the other player mirrors the move on the matching row. More generally, any even number of identical rows can be paired. Each move in one member of a pair can be copied in the other member, eventually giving the mirroring player the final move.

How to win with seven rows

Return to seven rows of three. The winning opening is to remove all three sticks from one row. What remains is six rows of three. Each of the six rows can be paired with an identical partner. Whatever your opponent removes from one row, you take the same number from its paired row. You restore symmetry after each of your turns, and because your opponent must eventually break the final pair, you will take the final stick.

It is worth checking the arithmetic: six rows of two would require removing nine sticks across several rows, which is illegal in a single move. A strategy must respect the rules, not merely describe an attractive position.

For an interview, I am far more interested in whether a candidate notices that issue, tests small positions and repairs the argument than in whether they produce the optimal opening immediately. Good mathematical reasoning includes checking whether the move you have imagined is legal. It also includes noticing that an idea that worked in one problem—the multiples-of-four pattern—may need to be adapted when the structure changes.

And what if the rows are all different? A challenge to take away

The seven-row exercise works especially nicely because the opening creates three perfectly matched pairs. But Nim is not restricted to equal rows. We can have two piles or twenty; some may contain one object, others a hundred. We can change the maximum number of objects that may be removed, alter whether the last move wins or loses, or impose additional restrictions on which pile can be touched.

Here is a homework problem that can grow with the student: invent your own take-away game. Choose the number of piles and the number of sticks in each one. Decide how many may be taken on a turn. Then try to determine which player can force a win, and explain the strategy without simply listing favourable moves.

Start with two unequal piles, then three. Limit each move to two sticks, or make taking the last stick a loss. Does mirroring survive? If not, identify a smaller counterexample. When you find a general rule, try to prove it.

This is why I love bringing Nim into teaching and interviews. It invites curiosity without requiring much formal knowledge, yet it rewards increasingly sophisticated ideas: backward induction, invariants, symmetry, strategic commitment, and eventually binary arithmetic (to develop more general solutions). It is also simply good fun. Five pounds on a classroom table can produce far more genuine intellectual engagement than a page of definitions.

If you use either of these games in a classroom, an admissions preparation session or at home, I would love to hear what happened. Did students spot the strategy? Did a hint change how they played? Did anyone invent a better variation? Please share this article with friends and colleagues, or get in touch with me, Revi, at revi@axiomtutoring.co.uk. I would be delighted to hear how others bring these ideas to life.