Every lattice on Pages 1–2 colors the point \((r,M)\) by evaluating an arithmetic quantity — a gcd, a totient, a depth, an angle — and mapping it onto the hue wheel. This page documents the exact formula behind each mode, in each of the three coloring scopes, with a live swatch rendered by that same formula: each swatch is a live lattice at block depth \(n=2\), switchable between Grid (\(r,M=1\ldots G\)), Ring (concentric moduli, dots at \(2\pi r/M\)), and Farey (\(x=r/M\), one row per \(M\)) views, with a size slider \(G=1\ldots109\) — capped at 109, a twin prime with 107.
The welcome teaser's five-view lattice (Smith · Ring · Grid · Farey · Gauss). One dropdown, w-color-mode — 5 modes, applied to all five views at once. Points with \(\chi(r)=0\) are always forced coral, regardless of mode.
The main six-view lattice. hero-color-mode — 23 local modes in five families, plus a global option that delegates to the Global palette. Gap-highlights and focus overrides pre-empt the mode color.
The shared palette, global-color — six numeric legacy modes (WebGL grid shader) plus the named modes. Consumed by Grid, Ring, the 3D Cube, and the Hero when set to Use global. Ring and Cube add small local overrides on top.
Four quantities appear in nearly every formula below. All are computed per point \((r,M)\) at the current block depth \(n\).
The Opener's palette is the "Residue Coloring Scheme" ported from the original project, plus a modular-distance default. Here ok means the point passes the character filter and block test; failing points keep the same hue but drop to ≈40% saturation and low alpha.
The Hero receives the precomputed depth \(d\) and animates: survivors pulse with \(\alpha = a_0 + a_1\sin(\omega t + 0.41r + 0.29M)\) in several modes (swatches below show the static mid-pulse value). Two overrides run before the mode switch: focused points render white, and gap-highlighted points take the gap family's color at full opacity.
Numeric modes 0–5 are the WebGL grid shader's palette (now also available as JS ports, so the Hero's Use global delegation resolves them). Named modes render in a Canvas-2D overlay pass. Modes already documented above (rainbow, farey family, gcd spectrum, φ-ratio, Möbius, block window, saturation, fail prime, mod residue, the ported foursome…) are shared verbatim — only the Global-exclusive modes are listed here.
Labels are the textual twin of the color modes: instead of mapping an arithmetic quantity to hue, they print it. The Opener has no label dropdown — its views draw view-specific annotations directly. The Hero and Global scopes each expose a selector.
| value | prints | meaning |
|---|---|---|
| none | — | No cell text. |
| coords | r, M | The raw lattice coordinates of the point. |
| fraction | r/M | The Farey fraction in lowest terms: \(\tfrac{r/g}{M/g}\) with \(g=\gcd(r,M)\). |
| angle | 2πr/M ° | The angular position \(\theta = 2\pi r/M\) on the unit circle, printed in degrees \(=360\,r/M\). |
| gcd | gcd(r,M) | The greatest common divisor; 1 marks character support, >1 marks a zero divisor. |
| depth | d | Survival depth \(d(r,M)\) — the largest \(n\) the point remains block-coprime for. |
| status | ok / cop / no | Three-state summary: block-survivor at current \(n\) / merely coprime to \(M\) / zero divisor. |
| fail_j | j | The first failure index: smallest \(j\le n\) with \(\gcd(r,M+j)>1\). |
| phi_M | φ(M) | Euler's totient of the modulus — the length of the reduced residue system on that ring. |
| mobius_M | μ(M) | The Möbius function of \(M\): \(0\) if \(p^2\mid M\), else \((-1)^{\omega(M)}\). |
| gap | |M−r| | The diagonal gap — distance to the \(r=M\) diagonal, the coordinate of Page 2's gap identity. |
| r_val ★ | r | Residue only (default). |
| M_val | M | Modulus only. |
| value | prints | meaning |
|---|---|---|
| rm | r/M | The fraction as written — the cell's Farey coordinate. |
| r ★ | r | Residue only (default). |
| ar | 0.xxx | The decimal value \(a_r = r/M \in (0,1)\) — the same quantity the sector and rainbow hues are built from. |
| theta | θ rad | \(\theta = 2\pi r/M\) in radians — the ring-view angular coordinate. |
| M | M | Modulus only. |
| gcd | gcd(r,M) | As above. |
| depth | d | Survival depth at the current block \(n\). |
| prop | varies | Adaptive: prints the quantity the active color mode is computed from — e.g. the divisor count under divisibility, the nilpotency degree under nilpotents — so text and color always agree. |
| none | — | No cell text. |
Two views layer a small local selector on top of the Global palette; both default to global (pass-through).
| scope | value | meaning |
|---|---|---|
| Ring | farey_angle | Hue by \(2\pi r/M\) — identical formula to the shared Farey rainbow, applied only in ring view. |
| Ring | farey_depth | Hue by the ring's position in Farey order — colors by \(M\)'s index rather than \(r/M\)'s value. |
| Ring | angular_dist | Brightness by angular distance from \(r/M\) to the nearest prime reciprocal \(1/p\) — the ring-view twin of Farey proximity. |
| Ring | lift_angle | The lift-shift coloring \(\theta(r \bmod (M{+}1),\,M{+}1)-\theta(r,M)\), restricted to ring view. |
| Cube | coprime | Three-state \(\gcd\) status per lattice site. |
| Cube | depth | Survival depth \(d\) as height-independent color. |
| Cube | gcd_rm | \(\gcd(r,M)\) spectrum, as in the shared mode. |
| Cube | saturation | First blocking prime \(p\le n{+}1\) dividing \(\gcd(r,M)\). |
| Cube | phi | \(\varphi(M)/M\) density of the site's modulus. |
| Cube | rainbow | Hue by angle \(r/M\). |