$$r_M \;=\; p \bmod M, \qquad M = p{+}1,\, p{+}2,\, \dots,\, G$$
Fix one prime p. On every ring of modulus M, mark the single residue where
p itself lands. As M climbs one step at a time, that one dot sweeps around each
ring at a different rate — the trail it leaves reads as a spiral arm winding outward through
the whole coprimality lattice. This page explains that overlay from the hero Ring/Lift view
(also seen driving the animated opener), lets you drive it directly, and shows exactly where
it re-enters the C(n) formula.
Not the Ulam spiral. The famous Ulam spiral lays every integer 1, 2, 3, … onto a square
grid path and highlights which cells are prime. This spiral is a completely different
construction: it's a single fixed prime's residue traced across a stack of concentric
coprimality rings as the modulus grows. Same word, unrelated geometry — see the aside near
the bottom of this page.
What You're Actually Looking At
Every ring of the hero visualization at modulus M holds the residues
$r \in \{1,\dots,M-1\}$ with $\gcd(r,M)=1$, arranged at angle $\theta = 2\pi r/M$ and radius
proportional to $M$ — this is exactly the Ring view used throughout the site. The spiral
overlay does one extra thing: for a chosen prime p, it computes
$r_M = p \bmod M$ for every ring $M$ from $p{+}1$ up to the largest ring $G$, and drops a
red marker there. Because $p \bmod M$ jumps around non-monotonically as $M$ increases, but
the ring radius grows steadily with $M$, the sequence of markers reads visually as a spiral
arm — not because anything is literally rotating, but because a fixed quantity ($p$) is
being viewed through an increasingly fine set of angular units ($1/M$ of a turn).
This is the same "Lift Dynamics" spiral overlay that drives the hero page's animated
opener and the Ring/Lift view's ▶ p control — this page isolates just that one mechanic
so it can be explained on its own, with its own controls and its own derivation.
The C(n) block depth slider below brings the opener's other mechanic here too: raise \(n\)
and the base lattice thins to the points with \(\gcd(r, M{+}j)=1\) for every \(j\le n\) — in every
view — while the measured density locks onto the Euler-product prediction \(D(n)=C(n)/\zeta(2)\).
Live Spiral
G — rings shown 42
Spiral prime
p=2
Winding
Play
View
C(n) block depth — a point survives iff gcd(r, M+j) = 1 for every j ≤ nn = 0
r ≡ p (mod M) — the spiralmirror σ(r) = M − rall-primes overlay (dim)dropout ring M = pC(n) survivors (n > 0)
Current prime
—
Spiral points plotted
—
Dropout ring (M = p)
—
Measured block density D̂
—
Predicted D(n) · C(n)
—
Drag isn't needed here — the geometry is flat (2D rings), unlike Page 8's 3D Ring stack. Tap ◀ ▶ to change the spiral prime, or press Play to sweep through every prime ≤ G automatically.
Where the Point Actually Lands
1 — Fix p, sweep M
For a chosen prime $p$ and each ring $M = p{+}1, \dots, G$, the marked residue is simply
$r_M = p \bmod M$. Since $p < M$ for every ring we draw, this is just $p$ itself whenever
$p < M \le$ (well inside range) — the interesting behavior only starts once $M$ has climbed
far enough that $p \bmod M$ genuinely wraps.
2 — Two winding directions
Toggling ▲/▼ switches between $r_M = p \bmod M$ (the "up" branch) and its reflection
$r_M = (-p) \bmod M = (M - (p \bmod M)) \bmod M$ (the "down" branch, taken to be $M$ itself
when the reduction is $0$, so the marker never lands on the excluded residue $0$). The two
branches are mirror images of each other under $r \mapsto M-r$ — which is exactly the
conjugate/mirror overlay (σ) you can toggle independently.
3 — Why it looks like a spiral and not noise
Radius grows linearly in $M$ (ring $M$ sits at radius $\propto M$), while angle is
$\theta_M = 2\pi r_M/M$. For $r_M = p \bmod M$, this angle doesn't grow monotonically —
but it does have long stretches where $p \bmod M \approx p$ (when $M$ is still much bigger
than $p$'s reductions), giving the smooth arcs you see between the sharper jumps. The
"jumps" happen exactly when $M$ passes a value at which $p \bmod M$ wraps around, i.e.
roughly every $M \approx p/k$ for integer $k$ — a genuinely number-theoretic cadence, not
an artifact of the drawing.
4 — The all-primes overlay is the same construction, superposed
Turning on "Overlay all primes" simply repeats steps 1–3 for every prime $\le G$
simultaneously, dimmed so the selected spiral prime still reads clearly. It's a useful way
to see that no single prime's spiral is special — every prime traces one, and they all
obey the same $r_M = p \bmod M$ rule.
The Dropout Ring Is Not Decoration
Turn on "Dropout ring" and look at what happens exactly at $M = p$: the ring itself is
drawn dashed, and the spiral marker is undefined there, because
$\gcd(p,p) = p \neq 1$ — the prime is never coprime to a modulus equal to itself. This
isn't a rendering edge case; it's the same saturation point that appears directly in the
C(n) formula's local factor:
$$\rho_p(n) = 1 - \frac{\min(n{+}1,\,p)}{p^2}$$
As the block depth $n$ grows, $\min(n{+}1,p)$ climbs linearly until it hits the ceiling $p$
— and it hits that ceiling exactly at $n = p-1$, i.e. once the block has grown wide
enough to guarantee it contains a full residue class mod $p$. That's the same $p$ that
exits its own multiplicative group at $M=p$ in this spiral: both are the moment a prime
stops being able to "dodge" the sieve and becomes fully accounted for. The dropout ring
you can see here is a geometric picture of the same saturation the tail-correction
analysis (see Page 6 / the derivation notes) bounds analytically via
$\sum_{p>y} 1/p^2 = O(1/(y\ln y))$.
From One Wave to All of Them
Everything above traces one prime across many rings. Now hold one ring \(M\) fixed and let every prime \(p\le N\) drop its marker at angle \(2\pi p/M\). Each marker is a unit complex number — a wave crest — and the whole picture your eye integrates is the exponential sum
$$S\!\left(\tfrac{a}{M}\right)\;=\;\sum_{p\le N} e^{2\pi i \, p a/M},$$
the superposition of one wave per prime, read at harmonic \(a\) of the ring. This is not a metaphor: interference here has a classical closed-form first-order amplitude. Writing \(d=\gcd(a,M)\), \(M'=M/d\),
with \(c_M(a)\) Ramanujan's sum and \(\mu\) the Möbius function — the deterministic interference amplitude. It predicts which harmonics glow, which cancel, the sign of the residue-class bias, and one startling special effect: if a square divides \(M'\), then \(\mu(M')=0\) and the interference is totally destructive at first order. The instrument below measures all of it. The ▶ Sweep p control above steps through the phasors of this sum one prime at a time.
The Interferometer
prime cutoff N100 000
ring modulus M30
harmonic a1
mode
—
Spokes: prime counts per residue class — gold spokes are the \(\varphi(M)\) coprime classes crowding toward \(\pi(N)/\varphi(M)\) each (dashed circle); your current spiral prime's residue is marked in pink. Phasor walk: the running sum \(\sum e^{2\pi i pa/M}\), one step per prime; the coral cross is the predicted endpoint \(\mu(M')/\varphi(M')\cdot\pi(N)\), the dashed circle is the \(\sqrt{\pi(N)}\) random-walk scale of the residual. Standing wave: the real interference pattern \(\mathrm{Re}\,[e^{-2\pi i r a/M}S]\) sampled at every node \(r\) — teal outward, coral inward, with nodes and antinodes exactly where the cosine puts them.
The Farey Spectrum — Major Arcs, Measured
spectrum depth — denominators q ≤ Q24
Hover the spectrum: each gold line is a measured \(|S(a/q)|/\pi(N)\) at a reduced fraction; each teal circle is the predicted \(|\mu(q)|/\varphi(q)\).
This is the circle method's major-arc landscape rendered literally: constructive peaks at low-denominator rationals with amplitudes \(|\mu(q)|/\varphi(q)\), and between them the minor-arc floor. Peaks at squarefree \(q\) only — every square-divisible denominator sits dark on the axis.
Total Destructive Interference — the μ Ladder
Tap a bar: measured \(|S(1/q)|/\pi(N)\) (gold) against predicted \(|\mu(q)|/\varphi(q)\) (teal tick).
The falsifiable exhibit. Squarefree moduli light up on prediction; the moment \(p^2\mid q\) (q = 4, 8, 9, 12, 16, 18, 25, 27…), \(\mu(q)=0\) and the measured amplitude collapses to the noise floor — first-order interference exactly cancelled by the Möbius sign structure. Nothing was fit: one formula, every bar.
The Exact Case — Ramanujan's Sum at a = 1, and the Mertens Function
Everything above sums over primes, so the \(\mu/\varphi\) law is asymptotic and its residual is
the hard part. There is a companion identity on the same ring that is exact and needs no primes
at all: sum the \(\varphi(M)\) coprime nodes themselves, as unit vectors, and the answer is the Möbius
function on the nose —
\[\sum_{\gcd(r,M)=1} e^{2\pi i r/M} \;=\; \mu(M)\]
This is \(c_M(1)\), the \(a=1\) case of the same Ramanujan sum the decoder table already reports.
Twelve unit vectors on ring 13 cancel to exactly \(-1\); eight on ring 24 cancel to exactly \(0\).
Note the cut is squarefree against squareful, not prime against composite: ring 15 sums to
\(+1\) as cleanly as any prime ring, while total cancellation happens precisely at
\(M = 4, 8, 9, 12, 16, 18, 20, 24\).
—
Running total of the ring cancellations, \(M(x)=\sum_{M\le x}\mu(M)\) — the Mertens function — against
the \(\pm\sqrt{x}\) envelope. Because \(\sum \mu(m)m^{-s} = 1/\zeta(s)\), this sum is tied directly to
the zeta function, and RH is equivalent to \(M(x) = O(x^{1/2+\varepsilon})\). That it stays this
flat is the whole content of the conjecture. Page 11 visualises Franel–Landau, a second and independent
RH equivalence built on the same lattice. Both statements are classical; neither is a route to a proof,
and reading \(\mu(M)\) off a ring costs \(\varphi(M)\) gcd evaluations where a sieve would give it for
almost nothing.
The Noise Floor — Square-Root Cancellation
—
For the current reduced harmonic \(a/M\), the residual \(E(N)=|S(a/M)-\tfrac{\mu}{\varphi}\pi(N)|\) is tracked as \(N\) grows, on log–log axes against a slope-½ guide. Honest labeling: square-root cancellation is what GRH-strength bounds predict for this residual; the plot measures consistency with that exponent, it does not prove anything. The minor arcs are where the primes keep their secrets — this panel is a picture of how well they keep them.
Per-Spoke Decoder — Every Harmonic of the Current Ring
a
gcd(a,M)
reduced a′/M′
μ(M′)
φ(M′)
predicted
measured |S|
err
Tap any row for the full reduction: gcd, Ramanujan sum \(c_M(a)=\mu(M')\varphi(M)/\varphi(M')\), prediction, measurement, and residual.
Aside — Why This Isn't the Ulam Spiral
Stanisław Ulam's spiral (1963) places the integers $1,2,3,\dots$ along an outward square
path and colors in the primes; the striking part is that primes cluster along certain
diagonals more than chance alone would suggest, hinting at patterns in quadratic
polynomials. It's a single static picture built from all integers at once.
The construction on this page shares only the word "spiral." It fixes one prime and tracks
its residue across a family of moduli — a dynamical trace through the Ring view's
existing coprimality lattice, not a placement of the integers themselves. If you'd like an
actual Ulam-style integer spiral added as a separate view later, that would be a genuinely
new visualization rather than an extension of this one — happy to scope that as its own
page if useful for SoME6.