Ulam Prime Spiral illustration

Ulam Prime Spiral

In 1963 Stanisław Ulam, doodling in a boring meeting, wrote the whole numbers in a square spiral and circled the primes. To his surprise the primes were not scattered randomly — they clumped along diagonal lines. This tool draws that Ulam spiral for as many numbers as you like, marking primes as bright dots, and lets you switch to Klauber’s triangle and the Sacks spiral, where the diagonals become sweeping curves. Hover to read off a number and whether it is prime. The streaks come from prime-rich quadratic polynomials, a visible echo of deep unsolved questions about how primes are distributed.

Runs 100% in your browser — simulations are computed locally on your device.

Notes

  • Each diagonal in the spiral corresponds to a quadratic like 4n² + bn + c; some of these polynomials are unusually rich in primes, so their diagonals light up.
  • The pattern persists at every scale and appears even when the spiral starts at numbers other than one, so it is a real property of the primes, not an artefact of the drawing.
  • Euler’s polynomial n² + n + 41 gives primes for all n from 0 to 39, one of the striking prime-rich lines you can spot in the spiral.
  • Runs 100% in your browser — simulations are computed locally on your device.