Modular addition
Example: (17 + 12) mod 5 = 4.
Calculate modular addition, subtraction, multiplication, exponentiation, remainders, and congruences. Supports negative integers and provides step-by-step explanations.
Enter integers and submit the form to calculate.
Modular arithmetic works with remainders after division by a positive integer called the modulus. Two integers are congruent modulo n if their difference is divisible by n.
Example: (17 + 12) mod 5 = 4.
Example: (3 - 10) mod 7 = 0.
Example: (8 × 9) mod 7 = 2.
Example: 3^4 mod 7 = 4. Repeated squaring avoids calculating the full power.
Example: 17 ≡ 3 (mod 7), because their difference is divisible by 7.
The calculator returns the least nonnegative remainder, between 0 and n - 1.
Mod gives the remainder after division. For example, 23 mod 6 = 5.
Yes. Negative integers are supported, and the calculator normalizes the remainder to a nonnegative value.
Two integers are congruent modulo n when their difference is divisible by n.
No. This version accepts nonnegative exponents. Negative modular exponents require a modular inverse.