Why do prime numbers make these spirals? | Dirichlet’s theorem and pi approximations
Based on 3Blue1Brown's video on YouTube. If you like this content, support the original creators by watching, liking and subscribing to their content.
Plotting (p, p) in polar coordinates turns arithmetic progressions into geometric spiral arms because adding k to p rotates by k radians and increases radius by k.
Briefing
Plotting points (p, p) in polar coordinates—using radius r = p and angle θ = p radians—creates outward Archimedean spirals. When all integers are included, the spirals look clean. Filtering down to primes makes the picture look chaotic at first, then reveals a structured “Milky Way” of spiral arms and missing sections. The central insight is that the gaps and surviving arms come from basic divisibility constraints on primes, while the long-run balance of primes across the remaining arms is governed by Dirichlet’s theorem.
The construction turns each step of +1 in p into a rotation by 1 radian while also increasing the radius by 1. Because 6 radians is close to 2π, counting by 6 produces points whose angles nearly complete a full turn each time; visually, that near-commensurability separates the integers into six spiral arms. More precisely, the arm corresponds to a residue class modulo 6: numbers that leave the same remainder when divided by 6. When primes are selected, most arms vanish. A prime cannot be a multiple of 6, cannot be 2 more than a multiple of 6 (those are even), and cannot be 3 more than a multiple of 6 (those are divisible by 3). Only the residue classes compatible with primality remain, aside from the small exceptions 2 and 3.
Zooming out changes the scale. Now the relevant near-rotation is 44 radians, which is close to 7 full turns because 44/(2π) is just above 7. This yields 44 residue classes modulo 44, each forming its own spiral arm. Primes eliminate entire arms whenever the corresponding residue class forces a composite structure—e.g., residues that make numbers even or divisible by 11. What survives are exactly the residue classes that are coprime to 44 (share no prime factors with 44). Counting those coprime residues gives Euler’s totient function: φ(44) = 20. The picture’s “missing teeth” and the number of visible arms trace directly to this totient count.
The same mechanism repeats at an even larger scale using a striking rational approximation: 710 radians is extremely close to an integer multiple of 2π. That approximation is tied to the famous fraction 355/113 for π, since 355/113 ≈ π. Because 710 is built from prime factors 2, 5, and 71, residue classes modulo 710 that are divisible by any of these factors cannot contain primes (except for the factor itself). Visually, this produces alternating rays, occasional gaps, and clumps whose structure reflects which residue classes are ruled out by divisibility.
The most consequential part is not the geometry but the distribution. Within the residue classes that remain possible—those coprime to the modulus—primes appear to spread evenly. Dirichlet’s theorem makes that expectation precise: for any modulus n and any residue r that is coprime to n, the primes congruent to r (mod n) have asymptotic density 1/φ(n). In other words, every admissible residue class gets infinitely many primes, and in the long run they occupy an equal share among the φ(n) allowed classes. The proof’s machinery leans on analytic number theory, including complex analysis, and the theorem underpins modern work on prime gaps and related conjectures.
Cornell Notes
Plotting points (p, p) with angle θ = p radians turns arithmetic structure into geometry: near-integer multiples of 2π create visible spiral arms. Modulo 6, the near-commensurability of 6 radians with 2π splits integers into six residue-class arms; most disappear for primes because many residues force evenness or divisibility by 3. Modulo 44, the near-commensurability of 44 radians with 7 turns creates 44 arms, but primes only survive in residue classes coprime to 44, counted by φ(44)=20. At the larger scale, the exceptional approximation 355/113 ≈ π (equivalently, 710 radians ≈ integer·2π) explains why rays look straight for a long distance. Dirichlet’s theorem then guarantees that primes are not just present but asymptotically evenly distributed across all admissible residue classes, each with density 1/φ(n).
Why do spiral arms appear at all when plotting (p, p) in polar coordinates?
How does filtering to primes remove specific spiral arms modulo 6?
What changes at the larger scale with modulus 44, and why does φ(44)=20 matter?
How does the approximation 355/113 ≈ π connect to the geometry at modulus 710?
What does Dirichlet’s theorem add beyond the divisibility-based gaps?
Review Questions
- In the polar plot, what role does the near-relationship between k radians and multiples of 2π play in producing spiral arms?
- For a modulus n, which residue classes are guaranteed to contain no primes (except possible small exceptions), and how is that determined using gcd(r, n)?
- State the key density conclusion of Dirichlet’s theorem in terms of φ(n) and residue classes coprime to n.
Key Points
- 1
Plotting (p, p) in polar coordinates turns arithmetic progressions into geometric spiral arms because adding k to p rotates by k radians and increases radius by k.
- 2
Spiral arms correspond to residue classes modulo k; near-commensurability (k ≈ integer·2π) makes each residue class trace a distinct curve.
- 3
Most spiral arms disappear for primes because many residue classes force divisibility by small primes (e.g., mod 6 eliminates multiples of 2 and 3).
- 4
At modulus 44, the surviving arms are exactly those residue classes coprime to 44, and their count is φ(44)=20.
- 5
At modulus 710, the exceptional rational approximation 355/113 ≈ π explains why rays look nearly straight for a long distance.
- 6
Dirichlet’s theorem guarantees that primes are asymptotically evenly distributed across all residue classes coprime to n, with density 1/φ(n).