Chinese Remainder Theorem Calculator

Enter the remainders and the moduli, each separated by commas.

The remainders a, separated by commas.

The moduli m, separated by commas, each 2 or more.

Try

Result

You entered2 congruences\text{2 congruences}

No solution\displaystyle \text{No solution}
Show the work
  1. Compatibility of two congruences

    Both congruences force xx to leave the same remainder mod g=gcd⁡(4,6)=2g = \gcd(4, 6) = 2, which is impossible unless gg divides a2−a1a_2 - a_1.

    Using x≡a1(modm1), x≡a2(modm2) need gcd⁡(m1,m2)∣a2−a1x \equiv a_1 \pmod{m_1},\ x \equiv a_2 \pmod{m_2} \text{ need } \gcd(m_1, m_2) \mid a_2 - a_1

    x≡1(mod4),  x≡2(mod6),  2∤1x \equiv 1 \pmod{4},\ \ x \equiv 2 \pmod{6},\ \ 2 \nmid 1
  2. Result

    No solution (the congruences contradict each other mod 2)

Worked examples