Numbers in polar coordinates

Draw every whole number n at distance n from the center and at angle n radians. That is all. Yet the dots wind into 6 arms, then 44 spiral arms, then 710 straight rays, and the primes pick out only some of them. The pattern is not hidden in the primes: it is in how close 6, 44 and 710 radians come to whole turns.

The primes up to 20,000 plotted in polar coordinates, forming spiral arms
The primes up to 20,000 plotted in polar coordinates, forming spiral arms

Polar coordinates

A point in the plane can be named by x and y, or by a distance r from the center and an angle θ from the positive x-axis. The two are linked by x = r cos θ and y = r sin θ. The polar number plot gives every whole number n the coordinates r = n and θ = n, with the angle measured in radians. So 1 sits at distance 1 and angle 57.3°, 2 at distance 2 and angle 114.6°, and so on: an outward spiral that turns about 57.3° per number.

The app can also turn one degree per number, or by the golden angle of about 137.5°, and can use r = √n, which spreads the dots evenly over the disc.

Six arms

Six radians is 343.8°, a little short of a full turn. So n and n + 6 point in almost the same direction, a bit clockwise. Up to a few hundred, the numbers form 6 arms that curl slowly backward: one arm for each remainder when you divide by 6.

Color the primes and only two arms light up, the numbers 6k + 1 and 6k + 5 (or 6k − 1). The other four arms hold multiples of 2 or of 3, and apart from 2 and 3 themselves, no prime can be on them.

44 spiral arms and 710 rays

Zoom out to tens of thousands and the 6 arms dissolve into 44 spiral arms. 44 radians is 7.0028 turns, much closer to a whole number of turns than 6 radians, so n and n + 44 line up better. That closeness is the same fact as 22/7 being close to π: 44 / 7 ≈ 2π.

The primes keep only the arms whose remainder mod 44 shares no factor with 44: 20 of the 44. Zoom out further, to a hundred thousand and more, and the arms straighten into 710 rays, because 710 radians is 113.00001 turns, the same coincidence as 355/113 ≈ π. The primes use 280 of the 710 rays, again those coprime to 710.

What the primes are really showing

Dirichlet proved in 1837 that every arithmetic progression a, a + q, a + 2q, … with a and q sharing no factor contains infinitely many primes, and later results show that the primes are shared out evenly between those progressions. In the plot, the progressions are the arms and rays. That is why all 20 prime arms out of 44 look about equally full. The spirals are a picture of residues, not a secret formula for the primes; Grant Sanderson's 3Blue1Brown video of 2019 made this exact picture famous.

Eighteen sets

Besides the primes, the app colors integers, even and odd numbers, multiples of 7 and of 10, twin primes (a prime with another prime 2 away), composites, semiprimes (a product of exactly two primes, like 15 or 49), highly composite numbers (more divisors than every smaller number: 1, 2, 4, 6, 12, 24, 36, 48, 60, 120 …), abundant numbers (divisors besides the number itself add up to more than it: 12, 18, 20 …), perfect squares and cubes, powers of 2, triangular numbers, Fibonacci numbers, palindromes and happy numbers (repeatedly summing the squares of the digits reaches 1, as 7 → 49 → 97 → 130 → 10 → 1).

Some sets make their own shapes. In degrees, the multiples of 10 form 36 straight rays. The squares, at r = √n, all sit at radius 1, 2, 3 … but turn by ever larger angles. With the golden angle and r = √n, the integers form the sunflower pattern of Helmut Vogel's 1979 model, and the Fibonacci numbers fall near one line.

Explore it in PictorX

Open the polar number plot and the primes up to 20,000 are drawn in their spiral arms. Switch number sets on and off, type how far to count (up to 200,000), and choose the angle, the radius and the dot size. The examples jump straight to six arms, 710 rays, the sunflower, 36 rays in degrees, even and odd, twin primes, and the numbers with many divisors. Scroll or pinch to zoom, drag to move, and point at a dot to read its number, its angle and every set it belongs to. Grow draws the numbers in order. Table counts each set up to N and lists every number with r, θ, x, y and its sets; copy the summary, download a CSV, or save the plot as a PNG or a PDF.

Frequently asked questions

Why do the numbers form spirals?

Because the angle grows by one radian per number, and 6, 44 and 710 radians are each close to a whole number of turns. Numbers that are 6, 44 or 710 apart therefore point in almost the same direction and line up into arms or rays.

Do the spirals mean the primes follow a pattern?

Not a new one. The primes avoid the arms whose numbers share a factor with 6, 44 or 710, and fill the others about evenly, as Dirichlet's theorem on primes in arithmetic progressions predicts.

What do 22/7 and 355/113 have to do with it?

44 radians ≈ 7 turns is the same as 44/7 ≈ 2π, or 22/7 ≈ π. 710 radians ≈ 113 turns is 355/113 ≈ π, which is correct to six decimals. That is why the 710 rays are nearly straight.

What is a happy number?

Replace the number by the sum of the squares of its digits and repeat. A happy number reaches 1, as 19 → 82 → 68 → 100 → 1. Every other number ends in the loop 4 → 16 → 37 → 58 → 89 → 145 → 42 → 20 → 4.

Ready to try it?

Open PictorX in your browser — no install, no credit card required to start.

Try the polar number plot