Prime Numbers and Pi


Prime Numbers and Pi

Anna
So I was looking at this really neat visualization the other day — plotting numbers in polar coordinates, where each point is at a distance and an angle equal to the number itself. For all integers, you get this nice Archimedean spiral.

Michael
Right, I've seen that. But the really striking part is when you plot only the primes — suddenly you see these galactic-looking spiral arms, and then when you zoom out even further, they turn into straight rays shooting outward.

Anna
Exactly. And there's a specific number of spirals: 20 in the middle scale, and 280 rays at the largest scale. The question is, where do those numbers come from? And why do some arms seem to be missing when you look at primes?

Michael
Well, it turns out the spiral pattern isn't really about primes at all. If you zoom out on just the whole numbers, you see the same kind of spirals — cleaner, and with 44 of them instead of 20. So the spirals come from something else.

Anna
Right. The key is that each step forward turns by one radian. So after 6 steps, you've turned 6 radians, which is just a little less than a full circle of 2π. That means numbers that are 6 apart end up at almost the same angle, creating a spiral arm. Those arms correspond to residue classes modulo 6.

Michael
Residue classes — that's just a fancy way of saying numbers with the same remainder when divided by 6. So for mod 6, the spirals are the classes 0,1,2,3,4,5. Now when you filter for primes, most of those arms vanish because primes can't be multiples of 2 or 3.

Anna
Exactly. Primes greater than 3 can only be 1 or 5 mod 6. So only two spiral arms survive. And that explains the smaller-scale pattern. But for the larger scale, you need a better approximation to 2π. Turns out 44 radians is very close to 7 full turns, because 44/7 is a classic approximation for 2π.

Michael
So that gives 44 residue classes mod 44, and each becomes a spiral arm. But primes can't be in classes that share a factor with 44 — that is, even numbers and multiples of 11. How many classes survive?

Anna
That's exactly Euler's totient function φ(44). Numbers from 1 to 44 that are coprime to 44. 44 has prime factors 2 and 11, so we remove all evens and multiples of 11. You're left with 20 numbers. That's why you see 20 spiral arms in the prime plot.

Michael
And the biggest scale? The 710 radians gives an even better approximation: 710/113 is nearly 2π, matching the famous 355/113 for π. So 710 steps almost exactly repeats the angle, creating nearly straight rays.

Anna
Right. Now 710 factors as 2 × 5 × 71. So to be a prime, a number can't be in a residue class that is even, a multiple of 5, or a multiple of 71. That eliminates a lot of the 710 rays. The survivors are the ones coprime to 710 — and φ(710) = 280. That's your 280 rays.

Michael
So the numbers 20 and 280 come from Euler's totient. But there's more: the primes in each surviving spiral or ray seem to be evenly distributed. That's not obvious — it's actually a deep theorem: Dirichlet's theorem.

Anna
Yes! Dirichlet's theorem says that for any modulus n, the primes are evenly spread among the residue classes that are coprime to n. For example, mod 10, primes greater than 5 can only end in 1,3,7,9, and each gets about 25% of the primes as you go out.

Michael
And it's not just about infinite primes in each class — Dirichlet proved that the proportion approaches 1/φ(n). That was a huge breakthrough in the 19th century, and it used complex analysis, which seems totally unrelated to primes.

Anna
Exactly. The proof is deep, but the result is beautiful. And it all came from someone just playing around with polar coordinates and noticing patterns. That's the takeaway: even playful exploration can lead you to profound mathematics like Dirichlet's theorem.

Ask anything
We've read this whole study set, so questions about it get the best answers.