HomeMathematicsChinese Remainder Theorem — Modular Rings (2D)

Chinese Remainder Theorem — Modular Rings (2D)

Interactive 2D Chinese Remainder Theorem simulator: three concentric rotating dials with coprime sector counts spin under a shared counter, plus a residue number-line trace, so you can watch their positions align on the unique CRT solution.

Mathematics2DModerate60 FPS📱 Mobile-adapted⇄ 3D version
2d-number-theory ↗ Open standalone

Three concentric rotating rings — each divided into a different prime number of sectors — sit under a single fixed pointer and spin together in the plane as a shared counter N ticks upward, like the wheels of a combination lock. Every ring 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 rings simultaneously show a chosen target sector. Below the rings, a number-line trace plots the same counter N growing linearly to the right, with colored ticks marking every multiple of each modulus and a gold marker at the CRT solution x (and every M-periodic repeat of it) — so you can see the same alignment moment two different ways: angularly on the rings, and linearly on the trace. Pick sector counts for the three rings, generate a random target puzzle, then play or step the counter and watch both views converge — live readouts track the counter, each ring'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 concentric rotating rings with coprime prime sector counts spin under a shared counter, with a linear number-line trace alongside them, letting you watch their residues align on the unique Chinese Remainder Theorem solution modulo the product of the moduli.

number theorymodular arithmeticchinese remainder theoremcryptographyprimes

2D · HTML5 Canvas 2D · 60 FPS target · runs fully client-side, no install

What did you find?

Add reproduction steps (optional)