Wind the integers and watch primes refuse to scatter.
Stanisław Ulam scribbled this during a dull seminar in 1963. Number the plane in a square spiral, mark the primes, and the diagonals appear by themselves — patterns we still can't fully explain. Zoom, pan, switch modes. At the foot of the page, the first dozen zeros of the Riemann zeta function — the deepest known music in the prime numbers.
The other side of the same coin
§ 02 · Zeta zerosThe diagonals you see on the spiral and these dots on the line are the same fact, twice.
Riemann's zeta function ζ(s) is built from the primes — yet its complex zeros, conjectured to all lie on the line Re(s) = ½, control how the primes are distributed down the number line. Every wobble in the prime-counting function π(x) corresponds to one of these dots. Prove they all sit on the line and you've proved the Riemann hypothesis: a million-dollar problem, and the closest thing mathematics has to a master key for the primes.
What you're looking at
§ 03 · Notes4n²+2n+1 — values that, for unexplained reasons, contain many primes.a + bi.(p, p+2). Whether infinitely many exist is open. Polymath8 and Maynard have pushed the bounded gaps frontier hard since 2013.p, every multiple 2p, 3p, … is struck out — what survives is prime, computed without a single division.Implementation notes — how the spiral and the sieve are computed
The Ulam spiral has a closed-form inverse: for a lattice point
(x, y) at Chebyshev distance k = max(|x|,|y|),
the previous ring ends at (2k−1)² and the four sides of
ring k give the integer at (x,y) in O(1).
Drawing is therefore a single pass over visible cells — no spiral
walk, no precomputed array of positions.
Primes are produced by a classical sieve of Eratosthenes up to the largest integer currently on screen, extended in segments whenever you zoom further out. The animation in Sieve mode replays that same algorithm at a configurable rate so you can see the composites being struck out, prime by prime, in spiral order.
Twin pairs are flagged by walking the prime list once; gap-colour uses the difference to the previous prime, mapped through a perceptual warm-to-cool ramp clamped at gap 50.
The 12 zeta-zero heights are hard-coded — they are constants of
nature, like π. The plot draws Re(s) = ½ as a vertical critical line
with each tₖ as a dot whose halo brightness fades with
height, hinting that they continue forever upward.