Modulo Operation

The modulo (or "modulus" or "mod") is the remainder after dividing one number by another.

Example: 100 mod 9 equals 1

Because 1009 = 11 with a remainder of 1


14 mod 12 equals 2

12 Hour Time

12-hour time uses modulo 12

Example: 14 mod 12 equals 2

Because 1412 = 1 with a remainder of 2

So 14 o'clock becomes 2 o'clock.

We are only interested in where we end up, not how many times around.

Play with it here:

images/mod-anim.js

Notation

We normally write "mod": 14 mod 12 = 2

Some programming languages use the percent sign: 14 % 12 = 2, but % is just a convenient symbol and has nothing to do with percents.

Modulus and Addition

You can also play with adding numbers using different modulo values here:

images/mod-circle-add.js

Modulus with Multiplication

You can also have a play with this. It multiplies each number by your chosen value, then links to the modulus of that multiplication. It makes some really interesting patterns:

images/mod-circle-mult.js