Number Spiral
Plot integers on a spiral and watch primes cluster on diagonal lines. Explore the Ulam spiral, Sacks spiral, and Vogel spiral to discover hidden structure in the distribution of prime numbers.
f(n) = 4n² + bn + c — Euler's prime-generating polynomials
Why Primes Form Patterns on Spirals
The Ulam Spiral
In 1963, mathematician Stanislaw Ulam was doodling during a boring talk when he
arranged integers in a spiral and circled the primes. To his surprise, the primes
fell along diagonal lines far more than chance would predict. These diagonals
correspond to quadratic polynomials of the form f(n) = 4n² + bn + c,
some of which produce an unusually high density of primes. The most famous is
Euler's polynomial n² + n + 41, which gives primes for
n = 0 through 39.
Sacks and Vogel Spirals
Robert Sacks' Archimedean spiral places each integer n at angle
√n · 2π and radius √n, creating smooth
curves where the Ulam spiral has sharp corners. The Vogel spiral uses the golden
angle (~137.508°) between successive points, the same arrangement nature uses
in sunflower seeds and pinecones. Both reveal the same diagonal prime clustering
from a different geometric perspective.
The Hardy-Littlewood Conjecture
The diagonal clustering is not an optical illusion. The Hardy-Littlewood conjecture (Conjecture F) predicts that certain quadratic polynomials produce primes with higher- than-average density, determined by the polynomial's discriminant and which primes divide its coefficients. This conjecture remains unproven but is supported by overwhelming numerical evidence — which you can see in this visualization.
Twin Primes and Other Patterns
Twin primes (pairs like 11 & 13, 17 & 19) form their own striking patterns on spirals, appearing in parallel lines next to the prime diagonals. Perfect squares form smooth parabolic curves, and Fibonacci numbers create a distinctive sparse pattern. Each highlighting mode reveals different structural properties of the integers, from the multiplicative (primes) to the additive (Fibonacci).