Skip to content
0:00 / 0:00

#3blue1brown#primenumbers#dirichlet'stheorem

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

3Blue1Brown

8.7M subscribers • 42 videos on Hallway

YouTube
  • Recommended by 7 people: 7 on Hacker News.
  • A classic. People kept recommending it from 2019 to 2024.
  • Presented by Grant Sanderson, creator of 3Blue1Brown
  • Linked in the description3b1b/manimarXiv 0808.1408

Intermediate. Assumes working knowledge.

7.6M views7 years ago7 recommendations

Computer scienceMath for programmersAlgorithmsComputation and complexity

Grant Sanderson explains why plotting prime numbers in polar coordinates creates spiral patterns, using modular arithmetic and rational approximations of pi.

A curious pattern, approximations for pi, and prime distributions. Help fund future projects: patreon.com/3blue1brown An equally valuable form of support is to simply share some of the videos. Special thanks to these supporters: 3b1b.co/spiral-thanks Based on this Math Stack Exchange post: math.stackexchange.com/questions/885879/meaning-of-rays-in-p… Want to learn more about rational approximations? See this Mathologer video. youtu.be/CaasbfdJdJg Also, if you haven't heard of Ulam Spirals, you may enjoy this Numberphile video: youtu.be/iFuR97YcSLM Dirichlet's paper: arxiv.org/pdf/0808.1408.pdf Timestamps: - The spiral mystery - Non-prime spirals - Residue classes - Why the galactic spirals - Euler’s totient function - The larger scale - Dirichlet’s theorem - Why care? Corrections: : 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. Thanks to these viewers for their contributions to translations Hebrew: Omer Tuchfeld ------------------ These animations are largely made using manim, a scrappy open-source python library: github.com/3b1b/manim If you want to check it out, I feel compelled to warn you that it's not the most well-documented tool, and it has many other quirks you might expect in a library someone wrote with only their own use in mind. Music by Vincent Rubinetti. Download the music on Bandcamp: vincerubinetti.bandcamp.com/album/the-music-of-3blue1brown Stream the music on Spotify: open.spotify.com/album/1dVyjwS8FBqXhRunaG5W5u If you want to

Why it's here

7 people recommend this

What people say. Highly recommended as an exceptionally clear and beautiful explanation of prime number spirals and modular arithmetic.

shezion Hacker News • Recommends

On “Ulam Spiral”

Here is one of the most enlightening explanations for these kinds of spirals I have seen by 3blue1brown: link to this video Note that the setup is slightly different,since in that video they plot numbers along their polar coordinates. The results are very similar, since both create spirals with predictable angular offsets.

excessiveon Hacker News • Recommends

On “Unexpected Beauty in Primes”

The first time I saw these, I thought it hinted at some deep insight into the nature of primes. However, after watching the following video, I think it just says something about modular arithmetic and rational approximations of 2 Pi. link to this video The video is only about Archimedian spirals, but I suspect a similar analysis would apply to Ulam spirals too. We really like to find patterns.

hinkleyon Hacker News • Recommends

On “Why do electron shells have set limits? (1999)”

In this vein, I really enjoyed 1brown3blue breaking down why prime numbers form patterns when graphed in polar coordinates. link to this video

lupireon Hacker News • Recommends

On “The Prime Hexagon”

3B1B has a semi related video on how working with prime numbers can help you see properties that are also found in composite numbers, since the sequence of primes overlaps with many other sequences. link to this video

andrewflnron Hacker News • Recommends

On “The Prime Hexagon”

For IMO a more meaningful phenomenon, this video by 3Blue1Brown explains why primes plotted as (p, p) in polar coordinates produce interesting patterns. link to this video

zimpenfishon Hacker News • Recommends

On “Breakthrough a step toward revealing hidden structure of prime numbers”

Numberphile1 and 3b1b2 (with a particularly good explanation of why it happens) have done good videos on the prime spiral. 1 link 2 link to this video

godelskion Hacker News • Recommends

On “Ask HN: What is the best software to visualize a graph with a billion nodes?”

> But after a fairly small size, there's almost no utility in visualizing graphs. I want to stress this point and go a bit further. It can be worse as people have pareidolia0, a tendency to see order in disorder. Like how you see familiar shapes in the clouds. There is a danger in that with large visualizations such as these that instead of conveying useful information, you counterproductively convince someone that something that isn't true is! Here's a relevant 3B1B video where this is kinda discussed. There is real meaning but the point is that it is also easy to be convinced of things that aren't true1. In fact, Grant's teaching style is so good you might even convince yourself of the…

mdieselon Hacker News • Mentions

On “How Many Decimals of Pi Do We Really Need? (2016)”

I've got Pi memorised more precisely than 355/113 as well for no good reason, and for engineering applications it doesn't serve any purpose. But the fraction is weirdly close and that's interesting for other (more academic) reasons, such as explaining why plotting primes in polar coordinates looks like a pattern: link to this video

sargstuffon Hacker News • Mentions

On “Λ-2D: Exploration of Drawing as Programming Language, Ideas from Lambda Calculus”

Warning: Bit of a 'Hitch hikers guide to the galaxy"/conway game of life yak shave for a reply. Nice start to providing a simple way to visually interact/experiment/manipulate different multiple Neural network concepts by loading/transforming any traditional code (working or not) & reshuffling/tesselating the structual representation of the code to generate a turing tape path via color execution paths. Switching to pi calculus could provide the theory to support coroutine/coprossing/ threading" multiple interacting tape paths/color combinations/path diffs/scaled recusion to perform assembly language instructions. Raster graphics without the yak ( link ) Feed back between tape & "traditiona…

curtisblaineon Hacker News • Mentions

On “Footsteps of pi”

I guess the Ulam spiral is more an artefact of the cartesian plane than an "hidden pattern": link to this video

mikhailfrancoon Hacker News • Mentions

On “Plotting Prime Numbers (2021)”

Ulam Spiral (and see ref to Martin Gardner's famous SciAm article): link Why do prime numbers make these spirals? | Dirichlet’s theorem and pi approximations - 3Blue1Brown link to this video

nmiloon Hacker News • Mentions

On “Numbers Are Leaves”

I'm not really sure what to say to this, other than watch this video and apply similar thinking to this problem: link to this video The leaf structure itself doesn't really have anything to do with ZF set theory or Von Neumann ordinals, other than supplying the inspiration for the base structure. Same way prime numbers don't generate the spirals in the video, all numbers do. So leave the ordinals out of this, experiment with different tree construction methods and you might uncover something cool about trees (but not necessarily about set theory)