Arithmetic
Modular Arithmetic
A clock reads 10, and in 5 hours it will say 3, not 15, that's modular arithmetic in action. The same mathematics protects internet passwords, bank transfers, and state secrets. Remainder arithmetic is one of the most practical branches of number theory.
- **Cryptography:** RSA, digital signatures
- **Hashing:** data distribution, checksums
- **Everyday life:** clocks, days of the week, schedules
The Modulo Operation
The modulo operation underpins almost every secure transaction online: RSA encryption (Rivest-Shamir-Adleman, 1977) relies on arithmetic modulo 2048-bit numbers, and elliptic-curve cryptography on the curve secp256k1 (used by Bitcoin since 2009) operates modulo a 256-bit prime. Roughly 95 percent of internet traffic by 2024 is protected by modular arithmetic of this kind.
The **mod** operation (modulo) returns the remainder after division. It is "cyclic" arithmetic: after a certain value, numbers start over.
**The mod operation:** a mod n = remainder when a is divided by n 17 mod 5 = 2 (because 17 = 3×5 + 2) 23 mod 7 = 2 (because 23 = 3×7 + 2)
Modular arithmetic is arithmetic "in a circle". After n−1 comes 0 again, just like on a clock face.
What is 47 mod 7?
Congruences
Two numbers are **congruent modulo n** if they have the same remainder when divided by n. Written as: a ≡ b (mod n).
**The ≡ symbol (congruence):** Don't confuse it with equality (=)! 17 ≠ 2, but 17 ≡ 2 (mod 5) These are different numbers but "equal modulo 5".
Congruences are the language of number theory. They let us work with infinite sets by looking only at remainders.