Chinese Remainder Theorem
Two dials turn together, one mod m and one mod n, until both show the residues you asked for. Then the whole grid lights up.
x0
0123456
00
1
2
3
4
1 / 35
Press play. Both dials advance by one each step; each x goes into the cell (x mod 5, x mod 7). Row 3 is the target for the first dial, column 4 for the second.
What to notice
- When gcd(m, n) = 1 the counter visits every cell of the m × n grid exactly once, so every pair (a, b) has exactly one x below m·n.
- Make m and n share a factor, e.g. 4 and 6: half of the grid is never reached, and some systems have no solution.
- RSA-CRT uses exactly this: work mod p and mod q separately, then glue the results. It is about 4× faster.