Chinese Remainder Theorem Solver
Combine several compatible remainders into one repeating solution.
How the chinese remainder theorem solver works
The Chinese remainder theorem combines several remainder conditions into one residue class when the moduli are pairwise coprime. This solver multiplies the moduli, forms a partial product for each congruence, and uses a modular inverse to isolate that congruence’s contribution. Adding those contributions and reducing by the full product yields the smallest nonnegative solution and the period of every other solution.
The defaults ask for a number leaving remainder 2 modulo 3, remainder 3 modulo 5, and remainder 2 modulo 7. Their modulus product is 105. The verified smallest solution is 23: dividing 23 by 3 leaves 2, by 5 leaves 3, and by 7 leaves 2. Every number 23 plus 105 times an integer has the same three remainders.
Reading chinese remainder theorem solver results privately
This implementation requires every pair of moduli to be coprime, matching the standard elementary theorem. Generalized systems with shared factors may still be solvable, but they need an additional compatibility check and are not handled here. Residues may be negative and are normalized during checking. The combined modulus must remain within JavaScript safe-integer precision. This chinese remainder theorem solver calculation runs entirely in your browser, so the numbers you enter never leave your device.
Frequently Asked Questions
Why must the moduli be pairwise coprime?
That condition guarantees each required modular inverse exists and guarantees one solution class modulo the product.
What does the combined modulus mean?
It is the period of the solution set. Adding or subtracting that product preserves every listed remainder.
Is the chinese remainder theorem solver private?
Yes. Its inputs and results stay in your browser. Bushe.co does not upload or store the values used in this calculation.
Browse the full set of free, private, in-browser tools.