Day 160 · Jun 8

Combinatorial Game Theory — Nim

Nim is a game: several piles of stones; players take turns removing any number from one pile; the player who takes the last stone wins. Despite its simplicity, Nim has a complete mathematical theory. Charles Bouton proved in 1901 that the winning strategy depends on the binary XOR of all pile sizes — if it is zero, the previous player wins; otherwise the current player wins. John Conway later showed that games themselves form a number system: the surreal numbers, which contain all real numbers, all infinities, and infinitesimals, all arising from the analysis of games.

In Nim with piles of 3, 5, and 7 stones, is the first or second player guaranteed to win? Compute the XOR of 3, 5, and 7 in binary to find out.

Practice related topics on DuelMath

Challenge someone →