The Modulo Operator

The mathematical operation modulo determines the remainder on dividing a number n by another number k. The result of n modulo k thus lies in the interval between 0 and k-1.

Example:

0 modulo 3 = 0 1 modulo 3 = 1 2 modulo 3 = 2
3 modulo 3 = 0 4 modulo 3 = 1 5 modulo 3 = 2
6 modulo 3 = 0 ...