WOLFRAM|DEMONSTRATIONS PROJECT

Modular Arithmetic

​
modulus
5
restriction
none
nonzero
units only
operation
plus
times
power
sum of squares
This visually illustrates various properties of modular arithmetic by creating an "operation table" modulo
n
, where 0 is represented by black, 1 by white, and other values by intermediate colors. The allowed numbers can be restricted to be nonzero or the units modulo
n
, and the operations are modular addition, subtraction, powers, and sums of squares.