Modular arithmetic
Appearance
![]() | This article needs to be wikified. (April 2009) |
Modular arithmetic is a form of basic arithmetic that is much like a clock, where once you get to twelve the numbers go back to zero.

In modular arithmetic you work with a particular base. In other words, the clock that you would work can have 12 numbers or 10 numbers or 100, or any number greater than zero. The base can be expressed as number of acceptable values. For example the base 3 values can be 0, 1 or 2. Generally any number can be converted to exactly one value from range <0, base-1>:
number mod base = value
Which is remainder after following division:
number / base
Numbers in modular arithmetics are expressed as
numberbase
or as
number mod base
Numerically:
1512
or as
15 mod 12
Examples of modular arithmetic:
In base 12 (like clock): 1012 = 10 mod 12 = |remainder(10 / 12)| = 10 1112 = 11 mod 12 = |remainder(11 / 12)| = 11 1212 = 12 mod 12 = |remainder(12 / 12)| = 0 1312 = 13 mod 12 = |remainder(13 / 12)| = 1 2312 = 23 mod 12 = |remainder(23 / 12)| = 11 2412 = 24 mod 12 = |remainder(24 / 12)| = 0
In base 3: 13 = 1 mod 3 = 1 33 = 3 mod 3 = 0 23 + 23 = (2 mod 3) + (2 mod 3) = 2 + 2 = 43 = 4 mod 3 = |remainder(4 / 3)| = 1 53 + 63 = (5 mod 3) + (6 mod 3) = 2 + 0 = 2
In base 10 (just like classic arithmetic with only last digit left): 910 + 110 = 1010 = 0 610 + 610 = 1210 = 2 1110 + 710 = 1810 = 8