HomeMathematicsChinese Remainder Theorem — Modular Gear Wheels

Chinese Remainder Theorem — Modular Gear Wheels

Interactive Chinese Remainder Theorem simulator: three interlocking gear wheels with coprime tooth counts spin under a shared counter, and you watch their residues align on the unique solution modulo the product.

Mathematics3DModerate60 FPS📱 Mobile-adapted⇄ 2D version
number-theory ↗ Open standalone

Three interlocking gear wheels — each with a different prime number of teeth — sit under a single fixed pointer and spin together as a shared counter N ticks upward. Every wheel shows N mod m for its own modulus, exactly the way a car odometer's wheels each track a different place value. Because the moduli are pairwise coprime, the Chinese Remainder Theorem guarantees there is exactly one value of N (modulo the product M) at which all three wheels simultaneously show a chosen target residue. Pick tooth counts for the three wheels, generate a random target puzzle, then play or step the counter and watch the wheels rotate — live readouts track the counter, each wheel's residue, and the CRT solution computed directly from the extended Euclidean algorithm, so you can verify the animation lands exactly where the formula predicts.

⚙ Under the hood

Three interlocking gear wheels with coprime prime tooth counts spin under a shared counter, letting you watch their residues align on the unique Chinese Remainder Theorem solution modulo the product of the moduli.

number theorymodular arithmeticchinese remainder theoremcryptographyprimes

3D · Three.js / WebGL renderer · 60 FPS target · runs fully client-side, no install

What did you find?

Add reproduction steps (optional)