Every problem on this page — combining residues, finding last digits, predicting clock positions, classifying days, validating divisibility rules — pulls from the same five operations. The table below collects them in one place: the procedure that produces the right answer, the compact formula, and a worked example that fits in a single row. Division gets its own row because it works differently from the rest.
| Operation |
Procedure |
Compact formula |
Worked example |
| Addition |
reduce each operand, add, reduce once more if the sum ≥ n |
(a + b) mod n = ((a mod n) + (b mod n)) mod n |
(47 + 38) mod 10: 7 + 8 = 15 → 15 mod 10 = 5 |
| Subtraction |
reduce each operand, subtract; if the result is negative, add n |
(a − b) mod n = ((a mod n) − (b mod n)) mod n |
(23 − 47) mod 10: 3 − 7 = −4 → −4 + 10 = 6 |
| Multiplication |
reduce each factor, multiply, reduce the product |
(a · b) mod n = ((a mod n) · (b mod n)) mod n |
(89 · 76) mod 9: 8 · 4 = 32 → 32 mod 9 = 5 |
| Exponentiation |
build the power one multiplication at a time, reducing after each step; detect the cycle once a remainder repeats |
ak mod n via repeated (· a) mod n; for large k, use exponent mod period |
74 mod 10: 7 → 9 → 3 → 1 (intermediates stay under 100) |
| Division |
does not pass through mod n directly; multiply by the modular inverse instead |
a / b ≡ a · b−1 (mod n), where b · b−1 ≡ 1 (mod n) |
the inverse b−1 may not exist — depends on gcd(b, n); full treatment lies in number theory |