Chinese Remainder Theorem Calculator

x ≡ aᵢ (mod nᵢ)

CalculatorsFreeNo Signup
4.7(304 reviews)
All Tools

Loading tool...

About Chinese Remainder Theorem Calculator

A Chinese Remainder Theorem calculator solving systems of simultaneous congruences. Enter multiple x ≡ a (mod n) equations, verifies pairwise coprimality, and finds the unique solution modulo N = n₁·n₂·...·nₖ. Shows step-by-step computation. Client-side.

Chinese Remainder Theorem Calculator Features

  • System solver
  • Step-by-step
  • Coprimality check
  • Verification
  • Multiple equations
Chinese Remainder Theorem (CRT): if n₁,...,nₖ are pairwise coprime, the system x≡a₁(mod n₁),...,x≡aₖ(mod nₖ) has a unique solution mod N=n₁·...·nₖ. Solution: x = Σaᵢ·Nᵢ·yᵢ (mod N) where Nᵢ=N/nᵢ and yᵢ=Nᵢ⁻¹(mod nᵢ).

How to Use

Enter congruences:

  • a, n: Each x ≡ a (mod n)
  • Solution: Unique x mod N
  • Steps: CRT computation

Algorithm

1. Verify pairwise coprimality. 2. Compute N=Πnᵢ. 3. For each i: Nᵢ=N/nᵢ, find yᵢ=Nᵢ⁻¹(mod nᵢ). 4. x = Σaᵢ·Nᵢ·yᵢ (mod N).

Applications

  • RSA encryption (combining mod p, mod q)
  • Fast Fourier Transform (NTT)
  • Calendar computations
  • Parallel computation

Step-by-Step Instructions

  1. 1Enter equations.
  2. 2Check coprimality.
  3. 3Compute solution.
  4. 4Verify all congruences.
  5. 5See steps.

Chinese Remainder Theorem Calculator — Frequently Asked Questions

What if moduli aren't pairwise coprime?+

CRT requires pairwise coprime moduli. If gcd(nᵢ,nⱼ)>1, the system may have no solution or can sometimes be reduced. If aᵢ≡aⱼ(mod gcd(nᵢ,nⱼ)), solutions exist and can be found by combining equations.

How is CRT used in RSA?+

RSA decryption: compute m^d mod pq. CRT speedup: compute m^d mod p and m^d mod q separately (smaller numbers), then combine via CRT. This is ~4× faster than direct computation.

What is the constructive proof?+

For each i, Nᵢ=N/nᵢ is divisible by all nⱼ (j≠i) but coprime to nᵢ. So Nᵢ has an inverse yᵢ mod nᵢ. Then aᵢ·Nᵢ·yᵢ ≡ aᵢ (mod nᵢ) and ≡ 0 (mod nⱼ) for j≠i. Summing gives the solution.

Share this tool: