Master modular arithmetic for addition, subtraction, multiplication, exponentiation with stepwise explanations shown. Compute inverses with extended Euclid, and solve Chinese remainders under coprime moduli. Handles negatives, big integers, fast power, and nontrivial edge cases gracefully. Export history to CSV or PDF with one click.
| Time (UTC) | Operation | Inputs | Result |
|---|
| Operation | Inputs | Expected Result |
|---|---|---|
| a mod n | a=17, n=19 | 17 |
| (a + b) mod n | a=17, b=11, n=19 | 9 |
| a^b mod n | a=7, b=222, n=29 | 16 |
| Inverse of a mod n | a=5, n=26 | No inverse (gcd=1? False; gcd=1 needed) |
| CRT | x≡2 (mod 3), x≡3 (mod 5) | x≡8 (mod 15) |
(a + b) mod n = ((a mod n) + (b mod n)) mod n(a - b) mod n = ((a mod n) - (b mod n)) mod n(a × b) mod n = ((a mod n) × (b mod n)) mod ngcd(a, n)=1; compute using Extended Euclid, take x mod n.x = a1·M1·inv(M1,n1) + a2·M2·inv(M2,n2) (mod N), where N=n1·n2, M1=N/n1, M2=N/n2.[0, n-1] for n>0.x mod n.a (mod n) exists exactly when gcd(a,n)=1. Otherwise, no multiplicative inverse exists in that modulus.n1·n2 requires coprime moduli. If gcd(n1,n2) ≠ 1, either no solution exists or there are multiple residue classes modulo the lcm.Important Note: All the Calculators listed in this site are for educational purpose only and we do not guarentee the accuracy of results. Please do consult with other sources as well.