Shows integers reduced to residues 0..n−1 on a modular ring, illustrating congruence (a == b (mod n) iff n divides a−b) and how residue classes partition the integers. In inverse mode it animates multiples of a on the ring to demonstrate that an inverse exists exactly when gcd(a,n)=1 (and highlights a^-1 where a·a^-1 == 1 (mod n)).
Pure Canvas2D, green-on-black blocky UI with snapped grid units. Includes pointer/touch interaction via event listeners attached once to the canvas (stored on the canvas object). Uses time-based cycling to animate wrap-around reduction and inverse search via multiples k·a mod n; extended Euclidean algorithm computes a^-1 when gcd(a,n)=1.