CurvG
Sign In

No. 6 · Number theory · Primes

Plot the primes in polar coordinates: why do spirals and rays appear?

Put every whole number n at distance n from the centre, turned by n radians. Zoom out and the numbers line up in 6 arms, then 44 spirals, then 710 rays; the primes sit on only 2, 20 and 280 of them. Zoom and see where the pattern comes from.

Why?

The explanation

The spirals belong to the whole numbers, not the primes: 6, 44 and 710 radians are each almost whole turns (44/7 and 710/113 are the best fractions for 2π). The primes only avoid the arms that share a factor with those numbers, and split evenly among the rest (Dirichlet’s theorem).

01One number, one point

Polar coordinates fix a point by how far it is from the centre and how far it has turned. Put the whole number nn at

r=n,θ=n radiansr=n,\qquad\theta=n\ \text{radians}

Every point lies on the Archimedean spiral r=θr=\theta, and neighbouring numbers are 1 radian (about 57.3°) apart. On the stage the primes are amber and the other numbers blue.

Close in there is only one loose spiral; the pattern appears as you zoom out.

02Why 6, 44 and 710

nn and n+mn+m point mm radians apart. If mm is almost a whole number of turns, n+mn+m lands just outside nn, a little off to one side, so every mm-th number joins into one slowly curving arm, mm arms in all:

6−2π≈−0.283,44−14π≈0.0177,710−226π≈0.000066-2\pi\approx-0.283,\quad 44-14\pi\approx0.0177,\quad 710-226\pi\approx0.00006

The smaller the miss, the straighter the arms: the 6 arms wind once every 133 numbers outwards, so they show around 150; the 44 spirals take about 15,600 to wind once; the 710 take 74 million, so below a million they look like rays.

The numbers come from the continued fraction of 2π2\pi:

2π=[6;3,1,1,7,2,146,… ]2\pi=[6;3,1,1,7,2,146,\dots]

Its convergents are 6,193,254,447,33353,7101136,\frac{19}{3},\frac{25}{4},\frac{44}{7},\frac{333}{53},\frac{710}{113}. The larger the next term, the better that fraction and the clearer its arms: 6 is followed by 3, 44 by 7, 710 by 146. Halved, they are the famous approximations 227\frac{22}{7} and 355113\frac{355}{113} for π.

03Which arms the primes keep

Arm rr holds the numbers mk+rmk+r. If rr and mm share a factor d>1d>1, every number on that arm is divisible by dd, and at most dd itself is prime. So primes sit only on arms where rr and mm have no common factor; there are φ(m)\varphi(m) of them (Euler’s totient):

φ(6)=2,φ(44)=20,φ(710)=280\varphi(6)=2,\qquad\varphi(44)=20,\qquad\varphi(710)=280

The 24 empty arms of the 44 are the even arms and the multiples of 11; 710=2×5×71710=2\times5\times71, so the empty rays hold multiples of 2, 5 or 71.

04Dirichlet: an even split

In 1837 Dirichlet proved that whenever rr and mm have no common factor, mk+rmk+r contains infinitely many primes, and in the long run every such arm gets the same share.

The stage’s own numbers bear it out: the 78,498 primes below a million, sorted by remainder mod 44, put between 3874 and 3964 on each of the 20 arms; over the 280 rays of 710 they average about 280.

So the pictures do not say that primes hide a spiral structure; they say two plainer things: whole numbers form spirals in polar coordinates, and primes spread evenly over the arms they are allowed.

Questions

Can this be used to find primes?

No. The picture only tells you which arms can hold no primes (those sharing a factor with the count); on the allowed arms, which numbers are prime still has to be checked one by one, and looks close to random.

Is this the Ulam spiral?

No. The Ulam spiral winds the integers in a square spiral, where primes often line up along diagonals that correspond to quadratic polynomials, such as Euler’s $n^2+n+41$, prime for every $n$ from 0 to 39. The spirals and rays here come from fractions close to 2π.

What if I use degrees instead of radians?

Then every 360th number comes back exactly, and the picture becomes 360 perfectly straight rays that never curve. The primes sit on $\varphi(360)=96$ of them. Radians make a full turn the irrational 2π, which is what bends the arms into spirals.

The syllabus side

Related curves

Sources: Dirichlet’s theorem on arithmetic progressions — Wikipedia · Continued fraction — Wikipedia · Ulam spiral — Wikipedia