Page 3 · Reference — Color & Label Codex

Every pixel is a function of (r, M, n)

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.

Opener

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.

Hero

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.

Global

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.

All canvases View:
Block depth n: 0
\(C(n)=\zeta(2)\prod_p\Big(1-\tfrac{\min(n+1,\,p)}{p^2}\Big)\) =
12px
Smith zoom-out:
Dirichlet Character Controls
Custom rings M: only listed moduli render, on every canvas

Shared predicatesEVERY MODE BUILDS ON THESE

Four quantities appear in nearly every formula below. All are computed per point \((r,M)\) at the current block depth \(n\).

COPRIMALITY — \(\gcd(r,M)=1\). Equivalently \(\chi(r)\neq0\) for Dirichlet characters mod \(M\). When \(\gcd(r,M)>1\) the point is a zero divisor of \(\mathbb{Z}/M\mathbb{Z}\); the Opener and Hero render it coral rgba(224,80,96,.78) before any mode logic runs.
BLOCK-COPRIMALITY — the defining predicate of \(C(n)\): \[ B_n(r,M)\iff \gcd(r,\,M+j)=1 \quad\text{for all } j=0,1,\ldots,n. \] Modes call this ok / block / pass; survivors are typically drawn vivid, non-survivors dim.
SURVIVAL DEPTH — \(d(r,M)=\max\{n : B_n(r,M)\}\), the deepest block the point survives. The Hero passes \(d\) into its color function; \(d<0\) means not even coprime to \(M\) itself.
FIRST FAILURE — the smallest \(j\) with \(\gcd(r,M+j)>1\), and its fail prime \(\operatorname{spf}(\gcd(r,M+j))\), the smallest prime factor of that gcd. These drive the survival-gradient and fail-prime spectra.

Opener modesw-color-mode · 5 MODES · ALL FIVE VIEWS

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.

Hero modeshero-color-mode · 23 LOCAL + GLOBAL DELEGATION

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.

Global modesglobal-color · 6 NUMERIC + NAMED · GRID / RING / CUBE / HERO-VIA-GLOBAL

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.

Label modesWHAT THE TEXT ON EACH CELL MEANS

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.

Hero — hero-label-mode

valueprintsmeaning
noneNo cell text.
coordsr, MThe raw lattice coordinates of the point.
fractionr/MThe Farey fraction in lowest terms: \(\tfrac{r/g}{M/g}\) with \(g=\gcd(r,M)\).
angle2πr/M °The angular position \(\theta = 2\pi r/M\) on the unit circle, printed in degrees \(=360\,r/M\).
gcdgcd(r,M)The greatest common divisor; 1 marks character support, >1 marks a zero divisor.
depthdSurvival depth \(d(r,M)\) — the largest \(n\) the point remains block-coprime for.
statusok / cop / noThree-state summary: block-survivor at current \(n\) / merely coprime to \(M\) / zero divisor.
fail_jjThe 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 ★rResidue only (default).
M_valMModulus only.

Global — global-label-mode (Grid & Ring)

valueprintsmeaning
rmr/MThe fraction as written — the cell's Farey coordinate.
r ★rResidue only (default).
ar0.xxxThe 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.
MMModulus only.
gcdgcd(r,M)As above.
depthdSurvival depth at the current block \(n\).
propvariesAdaptive: 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.
noneNo cell text.

Satellite overridesRING & CUBE LOCAL SELECTORS

Two views layer a small local selector on top of the Global palette; both default to global (pass-through).

scopevaluemeaning
Ringfarey_angleHue by \(2\pi r/M\) — identical formula to the shared Farey rainbow, applied only in ring view.
Ringfarey_depthHue by the ring's position in Farey order — colors by \(M\)'s index rather than \(r/M\)'s value.
Ringangular_distBrightness by angular distance from \(r/M\) to the nearest prime reciprocal \(1/p\) — the ring-view twin of Farey proximity.
Ringlift_angleThe lift-shift coloring \(\theta(r \bmod (M{+}1),\,M{+}1)-\theta(r,M)\), restricted to ring view.
CubecoprimeThree-state \(\gcd\) status per lattice site.
CubedepthSurvival depth \(d\) as height-independent color.
Cubegcd_rm\(\gcd(r,M)\) spectrum, as in the shared mode.
CubesaturationFirst blocking prime \(p\le n{+}1\) dividing \(\gcd(r,M)\).
Cubephi\(\varphi(M)/M\) density of the site's modulus.
CuberainbowHue by angle \(r/M\).