Skip to content

Primes in polar coordinates, zooming from the spiral to 44 arms, 280 rays and a swirl, with video export.

The number lineThe primes lit on the number line. Now wind it up: each number n turns n radians round the centre, at distance n.
The number lineFinding the primes up to 40M…

What the zoom passes through, and why. Press one to go there; the arms and rays come from how close whole numbers of radians get to full turns, not from a hidden law of the primes.

Zoom with the wheel, a pinch, or by dragging up and down on the picture. Keys: Space plays and pauses, ← and → move through the zoom, + and − zoom in and out.

Numbers up to

40,000,000 numbers. The rays need about 1M, the swirl at the end 10M or more; 40M holds 2.4 million primes.

Colour

Blue near the centre, warm at the edge, at every zoom.

Shape
TikTok, Reels, Shorts
Video length

The video is the whole zoom, from the number line to the end, drawn frame by frame at full size in your browser. The PNG is the view on screen now, at twice the size. No watermark.

Found it useful? or .

What is the prime spiral?

The prime spiral on this page is the polar prime spiral: every whole number n is placed at distance n from the centre and turned n radians around it, so the numbers follow the Archimedean spiral r = θ, and only the prime numbers are lit. Seen close up it is just a spiral with a few dots. Zoom out and the dots arrange themselves into 6 spiral arms, then 44 arms, then 280 almost straight rays, and far enough out the rays bend again into a golden swirl.

Prime Spiral draws all of it live in your browser, up to 40 million numbers and 2.4 million primes, and plays the whole zoom on its own: the number line winds up into the spiral, and the view widens tenfold every few seconds while a caption says what you are seeing and why. You can stop at any stage, colour the primes by their remainder to see where the arms come from, and save the view as a PNG or the whole zoom as a 1080 × 1920 video for TikTok, Reels and YouTube Shorts.

Polar prime spiral with millions of primes forming 280 glowing rays around a bright centre, made with the Prime Spiral tool
Polar prime spiral with millions of primes forming 280 glowing rays around a bright centre, made with the Prime Spiral tool

How to use the Prime Spiral

  1. Watch the zoom. It starts by itself: the primes light up on a number line, the line winds into the spiral, and the camera pulls back from a dozen numbers to 40 million.
  2. Stop on a stage. Press Pause, drag the Zoom slider, scroll or pinch over the picture, or press a stage in the Stages list (spiral, rings, 6 arms, 44 arms, 280 rays, swirl) to jump there.
  3. Colour by remainder. In Spiral, choose mod 6, mod 44 or mod 710: every remainder gets its own colour, and each arm or ray turns out to be one colour.
  4. Show every number. Tick "Show every whole number" to see the composites dimly behind the primes: the arms are there for all numbers, the primes only leave some of them empty.
  5. Save it. Pick a shape (9:16, 16:9 or 1:1) in Save, then Make video for the whole zoom or Save PNG for the current view at twice the size. The link button copies a link that opens the same view.

Keyboard: Space plays and pauses, the left and right arrows step through the zoom, and + and − zoom in and out.

Why does the prime spiral have arms and rays?

The arms are not a secret law of the primes. They come from one fact about the number 2π, the size of a full turn in radians, and one fact about how primes are spread among remainders. Here is the whole explanation, stage by stage, as the zoom shows it.

6 spiral arms: 6 radians is almost a full turn

A full turn is 2π ≈ 6.283 radians. Six radians is a little less, so the numbers n, n + 6, n + 12, … each sit about 0.28 radians behind the last, and together they drift slowly round the centre in a spiral arm. There are six such families, one for each remainder 0 to 5 when divided by 6, so all the whole numbers form 6 arms. A prime bigger than 3 always leaves remainder 1 or 5 (otherwise it would divide by 2 or 3), so the primes live on only 2 of the 6 arms.

44 spiral arms: 44/7 is close to 2π

Further out a better match takes over: 44 radians is 7 full turns less 0.018 radians, because 44/7 = 6.2857 is very close to 2π. Numbers 44 apart nearly line up and drift round far more slowly, so the picture shows 44 arms, one per remainder mod 44. Primes can only land on the remainders that share no factor with 44 (odd, and not a multiple of 11). There are 20 of those, which is why the primes show 20 arms with gaps between them.

280 rays: 710/113 is extremely close to 2π

Zoom out further and the arms straighten into rays. The reason is the famous approximation 355/113 for π: 710 radians is 113 full turns less only 0.00006 radians. Numbers 710 apart sit almost exactly on one line through the centre, so every remainder mod 710 becomes a ray. 710 = 2 × 5 × 71, and the remainders that share no factor with it number φ(710) = 280: those are the 280 rays the primes fill. The others stay dark, which is what gives the rays their dashed, grouped look.

The swirl: the tiny error adds up

0.00006 radians is small but not zero. Every 710 numbers a ray turns by that much more, and after tens of millions of numbers the turn is several radians, so the straight rays bend into a swirl. Set the largest number to 10M or 40M to reach it; the zoom ends there.

Why every allowed ray gets primes: Dirichlet's theorem

The last piece is Dirichlet's theorem on primes in arithmetic progressions: for any modulus m, the primes are shared out evenly among the φ(m) remainders that are coprime to m. So none of the 280 allowed rays is empty or favoured; each holds about 1/280 of the primes. Turn on colour by mod 710 at the rays stage and you can see every ray take its own colour, evenly filled. Seen this way the spiral is a picture of two things: rational approximations of 2π decide the shape, and Dirichlet's theorem decides which parts the primes fill.

Prime spiral, Ulam spiral and Sacks spiral: the difference

People say "prime spiral" for three different pictures. The Ulam spiral, drawn by Stanisław Ulam in 1963, writes the numbers in a square spiral on a grid; primes cluster on diagonal lines, from quadratic polynomials such as n² + n + 41. The Sacks spiral puts n at radius √n and angle 2π√n, so the perfect squares line up on one ray. The polar prime spiral on this page uses radius n and angle n radians, the version made famous by a 3Blue1Brown video and by posts of its arms and rays; its patterns come from 2π, not from polynomials.

Making a prime spiral video for TikTok, Reels or Shorts

Open Save, pick 9:16 for TikTok, Instagram Reels and YouTube Shorts (1080 × 1920), 16:9 for YouTube or slides (1920 × 1080), or 1:1 for a post (1080 × 1080), choose 15, 30 or 60 seconds and press Make video. The tool draws every frame at its own moment, so no frame is dropped however many primes are on screen, and writes an MP4 (H.264) in Chrome, Edge and Safari, or WebM in browsers without it. The caption with each stage's explanation is written on the video unless you untick it, and it stays clear of the bottom and right edge where the apps put their buttons. There is no watermark and nothing is uploaded.

Limits

  • Up to 40 million numbers, 2,433,654 primes. Finding them takes about half a second on a laptop, longer on an older phone; the zoom starts at once with the first primes while the rest are found.
  • The spiral needs WebGL 2, which every current browser has.
  • "Show every whole number" covers the first million, where the arms of the composites are easy to see.
  • The zoom is centred on the origin, because every pattern here is a pattern around it.

More about primes

To see how the primes are found in the first place, open the Sieve of Eratosthenes, where every prime hops along the number line in arcs and knocks out its multiples. To see how the primes are tied to the zeros of the zeta function, open the Riemann Hypothesis Visualizer.

Frequently Asked Questions

What is a prime number spiral?

A prime number spiral is a picture of the whole numbers laid out along a spiral with the primes marked, to show how they are spread. In the polar prime spiral, each number n sits at distance n from the centre at an angle of n radians.

Why do the primes form spiral arms?

Because whole numbers of radians come close to whole numbers of turns: 6 radians is nearly one turn, 44 radians nearly 7 turns, 710 radians nearly 113 turns. Numbers 6, 44 or 710 apart line up, so all numbers form 6 arms, 44 arms, then 710 rays, and primes fill the ones whose remainder shares no factor with 6, 44 or 710.

Why are there 280 rays in the prime spiral?

Far out, numbers 710 apart lie almost on one ray, since 710/113 is very close to 2π. Of the 710 possible remainders, 280 share no factor with 710 = 2 × 5 × 71, and only those can hold primes larger than 71, so the primes show 280 rays.

Do the arms mean primes are not random?

No. Every whole number shows the same arms and rays; the primes only leave out the remainders they cannot have. Dirichlet's theorem says the primes are shared evenly among the allowed remainders, which is why every allowed ray fills up.

What is the difference between the Ulam spiral and the prime spiral?

The Ulam spiral writes numbers in a square spiral on a grid, where primes gather on diagonals. The polar prime spiral uses distance n and angle n radians, where primes gather in arms and rays that come from approximations of 2π.

How do I make a video of the prime spiral?

Open Save, choose 9:16, 16:9 or 1:1 and 15, 30 or 60 seconds, and press Make video. The whole zoom is drawn frame by frame in your browser and saved as MP4, with no watermark.

How many primes can it show?

Up to all 2,433,654 primes below 40 million, drawn at 60 frames per second on a recent computer or phone.