Why do prime numbers make these spirals?

Share
HTML-code
  • Published: 08 October 2019
  • A story of mathematical play.
    Home page: 3blue1brown.com
    Brought to you by you: 3b1b.co/spiral-thanks

    Based on this Math Stack Exchange post:
    math.stackexchange.com/questions/885879/meaning-of-rays-in-polar-plot-of-prime-numbers/885894

    Want to learn more about rational approximations? See this Mathologer video.
    cepnet.mobi/video/CaasbfdJdJg/video.html

    Also, if you haven't heard of Ulam Spirals, you may enjoy this Numberphile video:
    cepnet.mobi/video/iFuR97YcSLM/video.html

    Dirichlet's paper:
    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.

    ------------------

    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 contribute translated subtitles or to help review those that have already been made by others and need approval, you can click the gear icon in the video and go to subtitles/cc, then "add subtitles/cc". I really appreciate those who do this, as it helps make the lessons accessible to more people.

    ------------------

    3blue1brown is a channel about animating math, in all senses of the word animate. And you know the drill with YouTube, if you want to stay posted on new videos, subscribe: 3b1b.co/subscribe

    Various social media stuffs:
    Website: 3blue1brown.com
    Twitter: twitter.com/3blue1brown
    Reddit: reddit.com/r/3blue1brown
    Instagram: instagram.com/3blue1brown_animations/
    Patreon: patreon.com/3blue1brown
    Facebook: facebook.com/3blue1brown

Comments • 3 120

  • 3Blue1Brown
    3Blue1Brown   6 days back

    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.

    • Luca S
      Luca S  2 days back

      3Blue1Brown I’m a German ninth grader and I like maths and ur vid but now my brain makes weird noises and smokes.

    • Alex Stram Kurs Jones
      Alex Stram Kurs Jones  2 days back

      101 x 20 = 2020. 101 is a very interesting prime, I think. At least it is palindrome

    • Slawomir P Wojcik
      Slawomir P Wojcik  3 days back

      @Joe Banks First, let's make it clear between ourselves, that plane is a surface of a 2-sphere with an infinite radius. Secondly: S1 sphere is a boundary of a 2d disc, S2 sphere is a surface of a 3d ball and S3 sphere is a surface of a 4d ball (neither of the latter two you can see, or, to remain on a side of caution, most of us can't see them). This goes on. I think, then, that you wanted to see something where spiral is drawn in 3 d space and coordinates are (r, α, β), where α and β are angles from the x and y positive axes. Pity we don't enjoy true 3d vision, but only a binocular ("stereographic"? - where did Riemann got his idea from) projection of such onto a part of a sphere. I guess, you can go on from here on your own. I think it would be doable in GeoGebra. (I think 3Blue1Brown should use the standard terminology for spheres in his other videos. Moreover, geometric algebra and a proper torus are waiting.)

    • Juan Luis Claure
      Juan Luis Claure  3 days back

      an important erratum and I surprise to myself get it in the second read. It is too specific information that is hard to google it and find some Wikipedia about it, well I don't research enough is true too. cheers!

    • Joe Banks
      Joe Banks  4 days back

      my question is this, this points are on one plane of a circle, or i guess saying it's represented in 2D, what would this look like represented as a 3D sphere?

  • ß Gold
    ß Gold  20 minutes back

    "He who holds the secret of the seven stars in his right hand, and draweth the double sword from his mouth, and his countance was as the sun shineth in his strength"

    Revelations

    • Ashok Darbhe
      Ashok Darbhe  26 minutes back

      seriously, at least for a moment, you brought me tears in the end.


      and each time I see a new video from 3b1b it just keep getting better interms of animation, content and explanation. If GRANT you are reading this, remeber that you have changed the way people look at math...


      always greatful for that

      • Ashok Darbhe
        Ashok Darbhe  1 hours back

        "SWING ON THE SPIRAL.....", "SPIRAL OUT KEEP GOING......"






        mjk......

        • 2019 megigazulás
          2019 megigazulás  2 hours back

          Biostatistics, so mix it! The Bible says that the first team in the end. But two bitcoinb are dead!

          • Bouklk Ommklk
            Bouklk Ommklk  5 hours back

            It IS beautiful!! But..
            eventually that's no business of prime numbers!

            • Douglas Thompson
              Douglas Thompson  6 hours back

              Humans love to find patterns so they can figure out why a pattern exists.

              • DashRogue
                DashRogue  9 hours back

                I know this is supposed to be a close to layman video, but as someone who did math olympiads it hurts to hear someone refer to residue classes, mod m, Euler's totient function etc as overly fancy, unnecessary jargon D:

                • MrHoojaszczyk
                  MrHoojaszczyk  12 hours back

                  Why don't most of you look up Plasma/electric Universe. Explains everything

                  • Joseph Massaro
                    Joseph Massaro  13 hours back

                    I love the sentiment at the end, about stumbling upon something on your own before encountering it academically. The first time I did this, I felt like I needed to tell everyone - not as if the idea belonged to me, but just because it felt so exciting, almost like a validation of the pursuit of learning. I'm fairly sure that was a huge part of what "flipped the switch" for me and made me interested in learning in my last year of high school. Probably never would've went to college if not for that moment.

                    • Blizzard
                      Blizzard  13 hours back

                      I did not deserve to watch this for free.

                      • Thomas Slone
                        Thomas Slone  13 hours back

                        so you gonna make virtual spiral printed images that are circle shapped? thats nice one bro

                        • J K
                          J K  14 hours back

                          I absolutely LOVE how popular this video is. It gives me hope for humanity, after all.

                          • Edison Yhip
                            Edison Yhip  14 hours back

                            could you do a video explaining the Foucault pendulum and why the rate of rotation of the Earth times the sine of the number of degrees of latitude.

                            • あつあつゆっけ
                              あつあつゆっけ  15 hours back

                              旧2ch(5ch)数学板フェルマー最終定理についてのスレ主です。掲示板の内容話題にするの許しました。
                              しかし、これ凄いですね。
                              しかし、パソコン使うのは宇宙の法律違反なの知ってましたか!!??
                              あなたこのままいくと全て見付けてしまいますよ。何の思い出もなく。
                              将棋の動画載せて下さいよ。
                              本当に強いのかハチワンダイバーと言う漫画のザンガヘッドで調べます。

                              • Eze Arinze
                                Eze Arinze  15 hours back

                                I asked my teacher: "when Am I going to use maths?"
                                And my teacher responded: "Anytime you find it difficult sleeping just try using it" 😂😂😂

                                • Eze Arinze
                                  Eze Arinze  15 hours back

                                  I was finding it difficult sleeping until I came across the video. 😅😅😅

                                  • Guds777
                                    Guds777  16 hours back

                                    Pi is exactly 3...

                                    • Guillaume Ohz
                                      Guillaume Ohz  16 hours back

                                      I have no idea how you made this animation, but it is so smooth it looks incredible

                                      • Matti Perkiömäki
                                        Matti Perkiömäki  17 hours back

                                        That moment at 2.26, when the music changed, and when the pattern appeared, almost brought tears to my eyes. Such a beautiful layout of this extraordinary symmetry. I propose 3blue1brown for the academy award, the best director of the year.

                                        To add on this, the moment from 4:00 to around 4:02, I'm okay with the spirals and the rays, but did you guys see that crazy flower-like formation emerging from the zooming out?

                                        • Aleric Inglewood
                                          Aleric Inglewood  18 hours back

                                          Can you prove that the smallest possible value of n m | PI - n/m | = ~0.01 for any two natural numbers n and m? Namely for n=355 and m=113. No other positive integers, no matter how large, gives something smaller. Or?

                                          • Leo Colless
                                            Leo Colless  18 hours back

                                            Time to see a psychologist... wooo!

                                            • Ziii Mr.
                                              Ziii Mr.  20 hours back

                                              Очень интересно, жаль на русском таких видео почти не найти

                                              • Jayveersinh Raj
                                                Jayveersinh Raj  21 hours back

                                                Make a video for logarithm

                                                • Parwati Nishad
                                                  Parwati Nishad  21 hours back

                                                  Its real fun and enjoy to watch your video's

                                                  • 3DCGdesign
                                                    3DCGdesign  1 days back

                                                    Can you please plot the same graph but instead of 1, 2, 3,4, 5,6 use "1/3π, 2/3π, π, 4/3π, 5/3π, 2π" ? My guess is spirals all go bye-bye? But at least then the prime numbers may reveal something interesting.

                                                    • 3DCGdesign
                                                      3DCGdesign  1 days back

                                                      answer: they don't... well, they do if you chart growing numbers around a radial grid in a specific way. But if you pick a different arbitrary spacing, then you will find they don't.

                                                      • Corrado Campisano
                                                        Corrado Campisano  1 days back

                                                        7:20 so it's mod6, with just 1 and 5 as "generators"?

                                                        that reminds me about Bach-Leibniz music system,
                                                        which is mod12, with 1 and 11, plus 5 and 7, as generators

                                                        there is a whole playlist about that, hope someone could link it back here

                                                        • Corrado Campisano
                                                          Corrado Campisano  1 days back

                                                          9:09 which are the "generators" here?
                                                          https://en.wikipedia.org/wiki/Multiplicative_group_of_integers_modulo_n

                                                      • Juraj Dobrik
                                                        Juraj Dobrik  1 days back

                                                        There is prime generator, also a function which for sure get another prime... It's not hard... It's golden ratio with multiplication, than if you cut it by root or something it looks like good ratios too maybe....

                                                        • Juraj Dobrik
                                                          Juraj Dobrik  1 days back

                                                          And there is a generator which yields every prime. And also there is relation between those two sets of numbers. It's really simple.

                                                      • Epaminondas Silva
                                                        Epaminondas Silva  1 days back

                                                        Everything in this video is amazing, I've just got hypnotized by watching it. Tyvm for making it.

                                                        • Jordan Fischer
                                                          Jordan Fischer  1 days back

                                                          Wow, what you said at the end of the video made me realize why I'm so good at learning new things in math. I'm always playing with math, experimenting with the "fun" parts of topics. Prime numbers, sequences, modular arithmetic, rational approximation, number theory, combinatorics, digits of irrational numbers, numeral systems, differential systems, and fractals/chaos are generally what intrigue me, and they seem to show up everywhere, lol!


                                                          And I must say that statistics is the worst kind of "math" in existence. Let it be a science, not a subject of math.

                                                          • Johannes Tafferner
                                                            Johannes Tafferner  1 days back

                                                            Really good and illustrative video!
                                                            At the beginning I thought it's some kind of illuminati conspiracy, but you explained the reasons for this plotting very well!

                                                            • BoostedToD5
                                                              BoostedToD5  1 days back

                                                              pi is 3
                                                              e is 3
                                                              3 is 3
                                                              life is simple.

                                                              • Vsauce Mikàl
                                                                Vsauce Mikàl  1 days back

                                                                It could be universal code? I notice star trails have a very similar pattern and it’s all over the universe.

                                                                • Ozzy MGB
                                                                  Ozzy MGB  2 days back

                                                                  This video reminds me of the time when I read that 196,883 + 1
                                                                  = 196,884.

                                                                  • Jason Kendall
                                                                    Jason Kendall  2 days back

                                                                    My friend, your videos are so filled with wonder and fun, that I wish I'd kept with my math PhD rather than my current pursuit. Ah, well!

                                                                    It'd be nice to have a video about "lay research" mathematics, and how one could "contribute".

                                                                    • Cynical B.
                                                                      Cynical B.  2 days back

                                                                      I don't even like math

                                                                      • Milan Rybka
                                                                        Milan Rybka  2 days back

                                                                        Hello im enjoy

                                                                        • ClickThisToSubscribe
                                                                          ClickThisToSubscribe  2 days back

                                                                          Those patterns don't look very pointless to me. More like pointyful...

                                                                          • LuisT
                                                                            LuisT  2 days back

                                                                            The last minute of your talk was profound, enlightening and valuable: the connections of deep math concepts to many manifestations of reality. Thanks.

                                                                            • Quixotic Pantomathes
                                                                              Quixotic Pantomathes  2 days back

                                                                              When i was in 11th grade i figured out the primes followed 5k+6, 7k+6 kind of sequence (i had to think about this bcs of my exam failure) and noticed there was some weird pattern. Appently i was right i guess. But still that damn exam

                                                                              • Lawlhero
                                                                                Lawlhero  2 days back

                                                                                Man, if my math class played a video related to the topics we were studying in a similar fashion before giving the lecture, I would've been so much hyped for it.

                                                                                • Alexander Owers
                                                                                  Alexander Owers  2 days back

                                                                                  The practical and professional utility of understanding maths aside, videos like this highlight just how visceral the subject can be, and worth studying simply for curiosities sake. As someone who has long lamented my ignorance of the subject, thank you for increasing my motivation to do something about it!

                                                                                  • nekochen
                                                                                    nekochen  2 days back

                                                                                    Now play the pattern through morse code, the Illuminati wishes to speak with you.

                                                                                    • Douglas
                                                                                      Douglas  2 days back

                                                                                      Someone chose to plot numbers in a way that made a pretty pattern and was then surprised that a subset of these numbers made a modified version of this pattern... Hooplidooda!

                                                                                      • Rohan Das
                                                                                        Rohan Das  2 days back

                                                                                        Damn!!!! I want him as my tutor.

                                                                                        • Worldly Stats
                                                                                          Worldly Stats  2 days back

                                                                                          I dont understand a thing but im thoroughly enjoying this video

                                                                                          • MadSpacePig
                                                                                            MadSpacePig  2 days back

                                                                                            What makes those histograms and not bar charts? I thought histograms varied in bar width and used area to represent data?