How to use this calculator
Solve simultaneous congruences with either coprime or compatible noncoprime moduli.
- Enter Integer residues, Positive moduli. Match the units shown beside each field and review the result together with the assumptions below.
- Read the worked example below to check the expected input format and result.
- Compare another scenario by changing one input at a time. Use Reset to return to the starting values.
Generalized Chinese remainder system explained
Each input pair describes a congruence x ≡ rᵢ (mod mᵢ). The generalized Chinese remainder method merges compatible congruences even when moduli share factors; the result is one residue class modulo the least common multiple.
Inputs, symbols, and units
r— Integer residues- Remainders rᵢ in the listed congruences. Enter one integer for each modulus; negative residues are reduced to their equivalent nonnegative class.
m— Positive moduli- Positive integer moduli mᵢ, aligned position by position with the residue list.
Formula and method
Merge x ≡ rᵢ (mod mᵢ); two congruences are compatible only when their residues agree modulo gcd of their moduli.
When merging x ≡ a (mod M) with x ≡ r (mod m), a solution exists only if gcd(M,m) divides r−a. A successful merge produces the least nonnegative solution and the combined modulus lcm(M,m); calculations use exact integer arithmetic for supported safe-integer inputs.
A worked scenario
For x ≡ 2 (mod 3) and x ≡ 3 (mod 5), the least nonnegative solution is 8 and the combined modulus is 15, so all solutions are 8 + 15q. A compatible noncoprime example is x ≡ 2 (mod 6) and x ≡ 8 (mod 10), which merges to x ≡ 8 (mod 30).
- Least nonnegative solution: 8
- Solution modulus: 15
The moduli 3 and 5 are coprime, so the combined period is 15. For shared factors, a solution exists only when each residue difference is divisible by the corresponding greatest common divisor.
Assumptions and edge cases
Safe-integer list entries are converted to exact BigInt arithmetic; incompatible systems return an explicit error.
Frequently asked questions
Must moduli be prime?
No.
What if congruences conflict?
There is no solution and the calculator reports it.
Is the result unique?
It is unique modulo the least common multiple of the moduli.
How do I use the Generalized Chinese remainder system calculator?
Enter Integer residues, Positive moduli. Match the units shown beside each field and review the result together with the assumptions below.
What is a worked example of Generalized Chinese remainder system?
For x ≡ 2 (mod 3) and x ≡ 3 (mod 5), the least nonnegative solution is 8 and the combined modulus is 15, so all solutions are 8 + 15q. A compatible noncoprime example is x ≡ 2 (mod 6) and x ≡ 8 (mod 10), which merges to x ≡ 8 (mod 30). Least nonnegative solution: 8 Solution modulus: 15 The moduli 3 and 5 are coprime, so the combined period is 15. For shared factors, a solution exists only when each residue difference is divisible by the corresponding greatest common divisor.
Read our calculation methodology.