Why do prime numbers make these spirals? | Dirichlet’s theorem

Why do prime numbers make these spirals? | Dirichlet’s theorem
3Blue1Brown

A curious pattern, approximations for pi, and prime distributions.
Help fund future projects: https://www.patreon.com/3blue1brown
An equally valuable form of support is to simply share some of the videos.
Special thanks to these supporters: http://3b1b.co/spiral-thanks

Based on this Math Stack Exchange post:
https://math.stackexchange.com/questi...

Want to learn more about rational approximations?  See this Mathologer video.
https://youtu.be/CaasbfdJdJg

Also, if you haven't heard of Ulam Spirals, you may enjoy this Numberphile video:
https://youtu.be/iFuR97YcSLM

Dirichlet's paper:
https://arxiv.org/pdf/0808.1408.pdf

Important error correction: In the video, I say that Dirichlet showed that the primes are equally distributed among allowable residue classes, but this is not historically accurate.  (By "allowable", here, I mean a residue class whose elements are coprime to the modulus, as described in the video).  What he actually showed is that the sum of the reciprocals of all primes in a given allowable residue class diverges, which proves that there are infinitely many primes in such a sequence.

Dirichlet observed this equal distribution numerically and noted this in his paper, but it wasn't until decades later that this fact was properly proved, as it required building on some of the work of Riemann in his famous 1859 paper.  If I'm not mistaken, I think it wasn't until Vallée Poussin in (1899), with a version of the prime number theorem for residue classes like this, but I could be wrong there.

In many ways, this was a very silly error for me to have let through.  It is true that this result was proven with heavy use of complex analysis, and in fact, it's in a complex analysis lecture that I remember first learning about it.  But of course, this would have to have happened after Dirichlet because it would have to have happened after Riemann!

My apologies for the mistake.  If you notice factual errors in videos that are not already mentioned in the video's description or pinned comment, don't hesitate to let me know.

https://youtu.be/EK32jo7i5LQ

https://heisme.skymoon.info/article/SuggInfo/1351  

There are only two ways to live your life. One is as though nothing is a miracle. The other is as though everything is a miracle [Einstein]