What modular arithmetic means
In modular arithmetic, two numbers are considered equivalent (congruent) if they have the same remainder when divided by a given modulus. The notation a is congruent to b (mod n) means that a and b differ by a multiple of n. For example, 17 is congruent to 2 (mod 5) because 17 - 2 = 15, which is divisible by 5.
Everyday life uses modular arithmetic more than most people realise. Clock time is modular: 3 hours after 11 o'clock is 2 o'clock, because 11 + 3 = 14, and 14 mod 12 = 2. Days of the week cycle with modulus 7.
a mod n = a - n x floor(a / n)
The modulo operation returns the remainder after dividing a by n.