Prime Spiral Explorer

An interactive playground for seeing number theory: 100,000 integers laid out on spiral grids, with classifications, comparisons, and curve-fitting overlays that turn famous theorems into things you can point at. Primes glow amber; whatever you compare them against glows cyan; the one number that belongs to both gets a white halo.

Why a spiral?
In 1963, Stanisław Ulam got bored in a seminar, wrote the integers in a square spiral, circled the primes — and noticed they clump along diagonal streaks. The streaks are real: diagonals of the spiral trace quadratic polynomials in disguise, and some quadratics (Euler's famous among them) are unreasonably rich in primes. Nobody has fully explained why.
That accidental doodle is the seed of this app. Numbers march outward on a spiral; a classification panel decides who lights up. Because the layout is arithmetic rather than aesthetic, the patterns you see are theorems — or open problems — rather than rendering artifacts.
Classifications you can cross-examine
The "Show" selector colors any family — primes, and friends — while "Compare With" overlays a second family in a contrasting color and tallies the overlap. The screenshot above catches my favorite tally in the app:
- 9,592 of 100,000 numbers are prime — and indeed , the true count.
- Against triangular numbers, the overlap tally reads: primes only 9,591, triangular only 445, both 1.
That lone dot is 3 — the only number that is both prime and triangular. It's a two-line proof (every later triangular number inherits a factor from or ), but watching a hundred-thousand-dot field produce exactly one white dot makes the theorem feel like a census result. The app's counts are exact, which means you can use it to check claims like this, not just admire them.
Fitting curves to the streaks
The Quadratic Fitting panel closes the loop on Ulam's observation: pick dots along a streak and the app fits the quadratic through them, so the diagonal you noticed becomes a formula you can read. Hovering any dot reports its nature and prime factorization — the microscope to the spiral's telescope.
Small tool, old questions
None of this is research, and that's the point: the gap between "heard about the Ulam spiral" and "watched light up under my cursor" is exactly the gap this kind of toy exists to close. The primes don't care that we're watching. They streak anyway.