NIM ZERO

NIM ZERO · 2026.08.01-v1

What is nim-sum? XOR explained with 3–5–7

The nim-sum is the bit-by-bit exclusive-or (XOR) of every heap count. It is zero when each binary column contains an even number of 1s. In ordinary Classic Nim, zero is the balanced state you want to leave to the opponent.

Calculate the XOR

Write 3, 5, and 7 as 011, 101, and 111. XOR evaluates each column independently: 0⊕1⊕1 = 0, 1⊕0⊕1 = 0, and 1⊕1⊕1 = 1. The nim-sum is therefore 001, or 1.

Make the value zero

Reduce the heap of 7 to 6. Its binary row becomes 110, and 011 XOR 101 XOR 110 equals 000. The move takes one piece and passes a balanced position to the opponent.

Worked position

HeapBinary10
10113
21015
3111 → 1107 → 6
nim-sum001 → 0001 → 0

Method and source

Method: finite legal moves are exhaustively checked by Nim Zero’s pure rules engine. Mathematical source: C. L. Bouton, “Nim, A Game with a Complete Mathematical Theory,” Annals of Mathematics, Second Series 3, no. 1/4 (1901–1902), 35–39.

DOI: 10.2307/1967631 · 2026-08-01

Back to the game