Image for Arithmetic mod n

Arithmetic mod n

Arithmetic mod n, or modular arithmetic, involves working with numbers within a fixed set called a "circle" of size n. When you add or subtract numbers, you keep only the remainder after dividing by n. For example, in mod 5, adding 3 and 4 gives 7, but since 7 divided by 5 leaves a remainder of 2, the result is 2. This creates a system where numbers “wrap around” after reaching n, making it useful for tasks like cryptography, computer science, and clock arithmetic. Essentially, it’s a way to handle calculations where only the remainder matters, not the total size of the number.