In mathematics, a Residue Class Ring modulo a positive integer $\,n$ is an abstraction of the classification of integers with respect to their remainder when divided by $\,n$.
The Residue Class Ring $\mathbb{Z} / N\mathbb{Z}$
Mathematical Background
The presented p5.js application visualizes a residue class ring $\mathbb{Z} / N\mathbb{Z}$. For each value $i, j$ in the grid, the value of $(i \times j) \mod N$ is calculated and color-coded. Changes to $N$ instantly reflect the properties of the corresponding residue class ring.
Meaning of Colors
The colors in the representation are coded to highlight the different values of the residue class ring:
- Black (0): This color value represents the residue class 0. It occurs when the calculation is exactly divisible by $N$.
- White (1): This color marks the residue class 1, which is important as it serves as the multiplicative identity element in the ring.
Other colors follow a rainbow scheme to represent the remaining residue classes.
Controls
- Left/Right Arrow: Changes the value of $N$.
- Numbers 1-2: Change the calculation mode. The numbers correspond to the following calculations:
- 1: $(i + j) \mod N$
- 2: $(i \times j) \mod N$