Lemma › Techniques › Modular Thinking
Olympiad problem-solving technique

Modular Thinking

When the numbers are too big, shrink the universe.

Reduce everything modulo a well-chosen nn and infinite problems become finite. Powers cycle, squares hit only a few residues (0,1 mod 40, 1 \bmod 4; 0,1,4 mod 80, 1, 4 \bmod 8), and impossible equations reveal themselves in a finite check.

Choosing the modulus is the art: mod 4 or 8 for squares, mod 9 for digit sums and cubes, mod pp with Fermat for large exponents.

Where it appears on Lemma: Levels 4 and 7.

Guides on Modular Arithmetic

Train it on Lemma

Modular Thinking unlocks at Level 4 of Lemma's eight-level ladder, with lessons that teach it and drills that make it stick. 128 lessons, 1237 curated problems and unlimited generated practice at six difficulties. Free to start, no card, and the paid plan opens with 3 free days.

Find your level

More techniques