The video shows what happens when you plot points whose polar coordinates are both the same integer \(n\) (i.e., \((r,\theta)=(n,n)\)). As \(n\) increases the points trace an Archimedean spiral because each step adds one radian of angle and one unit of radius.
If you keep only the points where \(n\) is prime, most of the spiral arms disappear. This occurs because adding a fixed number \(k\) of steps rotates the point by \(k\) radians. When \(k\) is close to an integer multiple of \(2\pi\) (e.g., \(6\approx2\pi\), \(44\approx7\cdot2\pi\), \(710\approx113\cdot2\pi\)), the points of each residue class modulo \(k\) line up into nearly straight rays or very gentle spirals.
Prime numbers can appear only in those residue classes that are coprime to \(k\); all other classes consist entirely of even numbers or multiples of a factor of \(k\) and thus contain no (or very few) primes. Consequently, the visible arms correspond exactly to the totatives of \(k\) (the numbers less than \(k\) that share no prime factor with \(k\)).
When you look at many primes, they are evenly distributed among these allowable residue classes—about \(1/\phi(k)\) of the primes fall into each class, where \(\phi\) is Euler’s totient function. This uniform distribution across arithmetic progressions is Dirichlet’s theorem on primes in arithmetic progressions, a deep result in analytic number theory.
Thus, the seemingly random pattern of spirals and rays in the plot is a visual illustration of two unrelated facts: (1) certain integers give very good rational approximations to \(2\pi\), producing nearly straight lines, and (2) Dirichlet’s theorem guarantees that primes are spread uniformly among the residue classes that are coprime to those integers. The exercise shows how playful data‑visualization can lead to profound mathematical insights.
1. The pattern was first seen in a Math Stack Exchange question asked by user Dwymark and answered by Greg Martin.
2. The question relates to the distribution of prime numbers and rational approximations for π.
3. The user explored data in polar coordinates, where each point is given by a radius r and an angle θ.
4. In polar coordinates, angle is measured in radians, with π radians equal to half a turn and 2π radians a full turn.
5. Polar coordinates are not unique: adding 2π to the angle leaves the point unchanged.
6. The plotted points have both coordinates equal to a given integer n, i.e., (n, n).
7. For whole numbers, the sequence (n, n) forms an Archimedean spiral as n increases.
8. When only prime numbers are plotted, the points initially appear random.
9. At a moderate zoom‑out, clear spiral arms emerge, some of which seem missing.
10. At a larger zoom‑out, the pattern resolves into many outward‑pointing rays, mostly grouped in clumps of four with occasional gaps.
11. Counting the spiral arms for primes gives 20; counting the rays at the larger scale gives 280.
12. Plotting all whole numbers (not just primes) yields cleaner spirals, with 44 arms visible.
13. The appearance of spirals corresponds to residue classes modulo m, where m steps approximates a full turn (m ≈ 2πk for some integer k).
14. For m = 6, six steps is slightly less than 2π, so residue classes mod 6 produce the six‑arm spiral seen at small scale.
15. When restricting to primes, only residue classes that are coprime to the modulus remain visible.
16. For modulus 6, primes greater than 3 are congruent to 1 or 5 (i.e., 1 or 5 above a multiple of 6).
17. For modulus 44, the number of residue classes coprime to 44 is φ(44) = 20, where φ is Euler’s totient function.
18. Euler’s totient function φ(n) counts the integers from 1 to n that are relatively prime to n.
19. The integers that are relatively prime to n are also called the totatives of n.
20. Forty‑four steps is close to seven full turns because 44/(2π) ≈ 7.002, explaining the 44‑arm spiral for all integers.
21. For modulus 710, 710 steps is extremely close to 113 full turns because 710/(2π) ≈ 113.000095.
22. This gives the rational approximation 355/113 for π, which is unusually accurate.
23. The number of rays observed for primes at the largest scale is 280, which equals φ(710).
24. Since 710 = 2 × 5 × 71, φ(710) = 710 × (1 − 1/2) × (1 − 1/5) × (1 − 1/71) = 280.
25. Dirichlet’s theorem states that, for any modulus n, the primes are asymptotically evenly distributed among the φ(n) residue classes that are coprime to n.
26. Consequently, the proportion of primes in each such class tends to 1/φ(n) as the upper bound goes to infinity.
27. For modulus 10, this predicts that primes ending in 1, 3, 7, 9 each occur about 25 % of the time.
28. Dirichlet proved this theorem in 1837; it is a cornerstone of analytic number theory.
29. The proof relies heavily on complex analysis, the study of calculus with complex‑valued functions.
30. Understanding the distribution of primes in residue classes remains relevant today, e.g., in research on small gaps between primes and the twin‑prime conjecture.