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.
    iloverimini.mobi/video/CaasbfdJdJg/video.html

    Also, if you haven't heard of Ulam Spirals, you may enjoy this Numberphile video:
    iloverimini.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 074

  • 3Blue1Brown
    3Blue1Brown   4 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 hours 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  3 hours back

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

    • Slawomir P Wojcik
      Slawomir P Wojcik  1 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  2 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  2 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?

  • Milan Rybka
    Milan Rybka  54 minutes back

    Hello im enjoy

    • ClickThisToSubscribe
      ClickThisToSubscribe  2 hours back

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

      • LuisT
        LuisT  2 hours 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  3 hours 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  4 hours 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  4 hours 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  4 hours back

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

                • Douglas
                  Douglas  5 hours 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  5 hours back

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

                    • Worldly Stats
                      Worldly Stats  5 hours back

                      I dont understand a thing but im thoroughly enjoying this video

                      • MadSpacePig
                        MadSpacePig  6 hours back

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

                        • Edward Lau
                          Edward Lau  6 hours back

                          After seeing a video on Eratosthenes' sieve with Cyberworld by X-ray Dog as its music years ago, I can't help listening to the music while watching this video.

                          • Ojus Singhal
                            Ojus Singhal  7 hours back

                            I can never thank you enough 3blue1brown. Just how much you made me love math!

                            • Abdessamad El basri
                              Abdessamad El basri  7 hours back

                              i know you are this smart science guy and all but you spitting all over me man

                              • CASPERA
                                CASPERA  8 hours back

                                Suggestion: Series about Navier-Stokes

                                • Borgash the Shaman
                                  Borgash the Shaman  10 hours back

                                  *Hits the bong*
                                  “Damn those LSD fractal flashbacks are coming again”

                                  • Oscar Smith
                                    Oscar Smith  10 hours back

                                    Hey Grant, can you make T-shirts of these prime number spirals?

                                    • qwerty3.14
                                      qwerty3.14  11 hours back

                                      Please do part 2 where you talk about primes in complex analysis! I'm taking a complex analysis class right now!

                                      • shawnpheneghan
                                        shawnpheneghan  14 hours back

                                        Your opening reminded me of another alliteration. "The president's predecessors had a propensity to prevaricate, but the present president's prevarications are prolific. "

                                        • Maria Glass
                                          Maria Glass  14 hours back

                                          Because... Aliens!

                                          • TORIC
                                            TORIC  14 hours back

                                            I don’t know why but this brought tears to my eyes. 😍

                                            • Warren Ross
                                              Warren Ross  15 hours back

                                              Another beautiful video!

                                              • Joshua Speedy
                                                Joshua Speedy  17 hours back

                                                i have another strange curve for you, i took a set that went like i colored one black one red than two black and two red, then i took the bottom of it and i made it in a parabola, move the bottom up one, move the bottom up two, etc, i did this for both the positive and negative and i got wo clearly defined curves that had another section in the middle (this section was a cone like curve) that was clearly different, it had no seeming reason for it to be the sorta random it is. why does doing this make these sota curves?

                                                • john bonds
                                                  john bonds  17 hours back

                                                  Any interesting video ideas come to mine about the Ackermann Function?

                                                  • spling
                                                    spling  18 hours back

                                                    Magnificent!

                                                    • IMO Reviews
                                                      IMO Reviews  20 hours back

                                                      Awesome video

                                                      • omkr 01
                                                        omkr 01  20 hours back

                                                        I have read Uzumaki by Junji Ito! I find this video very spirally indeed

                                                        • Ryan Bennett
                                                          Ryan Bennett  20 hours back

                                                          This is the human experience. Our shared understanding of the world and how we attempt to understand the intricacies of it. The knowledge passed down to us that doesn't have an end, the knowledge that not only answers questions but spurs new ones in its place.


                                                          Cheers to you 3Blue1Brown, you give explanation to the rigor that drives some people away from exploring the truly beautiful world of mathematics.

                                                          • Rmri
                                                            Rmri  21 hours back

                                                            this is so amazing, mindblowing and awe inspiring at the same time... Thanks for sharing the explanation and the beautiful animations!!!

                                                            • Bella Welch
                                                              Bella Welch  21 hours back

                                                              what if you do just composites?

                                                              • Kampfkunst Kanal
                                                                Kampfkunst Kanal  22 hours back

                                                                This is so fantastic!

                                                                • matt club penguin
                                                                  matt club penguin  1 days back

                                                                  yes?

                                                                  • WolfgangLMclain
                                                                    WolfgangLMclain  1 days back

                                                                    ... Pure logic... My head feels fuzzy, my cheeks are flushed, and... Oh my.

                                                                    • Ariq Ahmer
                                                                      Ariq Ahmer  1 days back

                                                                      quick question what platform/software is used for graphing numbers like these?

                                                                      • Serdar Özkalkan
                                                                        Serdar Özkalkan  1 days back

                                                                        There is no "divine" etc.. in that. Since primes are distinctive numbers in maths, fractals and spirals are creating themselves obeying the second law of thermodynamics which is increased entropy.

                                                                        • Lapis Manalis
                                                                          Lapis Manalis  1 days back

                                                                          The set (p,p) in polar coordinates is a subset of the Archimedean spiral r = a*theta where a =1. Since this equation maps a spiral of course (p,p) will map a spiral since it is a subset of the Archimedean spiral. Other than that you can basically answer this using theta = s/r.

                                                                          • Rublie14
                                                                            Rublie14  1 days back

                                                                            If you'd zoom out even further, would there be another close approximation of pi that shows in the spiral? Is this a pattern that goes on infinitely?

                                                                            • ZaiDo 2
                                                                              ZaiDo 2  1 days back

                                                                              the spiral comes from the fact that 3~<π

                                                                              • Lapis Manalis
                                                                                Lapis Manalis  1 days back

                                                                                The spiral comes because the Set S = {(r,theta)| r = theta = p, where p is prime} forms a subset of the Archimedean spiral A = {(r,theta)| r = a*theta, a E R} where a = 1 and r = some prime.

                                                                            • Josua Thurnheer
                                                                              Josua Thurnheer  1 days back

                                                                              I would like to se a simulation or visualization on how prime numbers and other stuff would look like on a binary, 11, 24 or another number of digits sistems. Like, ending with the same number in prime is only an artifact of the 9 digit sistem we have build. What if there was only 6 or 21 digits?

                                                                              • Akshansh Choudhary
                                                                                Akshansh Choudhary  1 days back

                                                                                I just want to say one thing, this guy re-ignited my love for Mathematics !

                                                                                • Nightmare Court Pictures

                                                                                  This is probably how Hawking saw physics in the universe.

                                                                                  • Isaiah Loh
                                                                                    Isaiah Loh  1 days back

                                                                                    ok

                                                                                    • Thomas Pham
                                                                                      Thomas Pham  1 days back

                                                                                      No fucking way that’s amazing

                                                                                      • Gary Rogers
                                                                                        Gary Rogers  1 days back

                                                                                        Love your videos! Always a joy to watch

                                                                                        • Sasuke Uchiha
                                                                                          Sasuke Uchiha  1 days back

                                                                                          Mathematik scheint mir das Problem der Menschen zu sein die die Sprache nicht benutzen.

                                                                                          • Sasuke Uchiha
                                                                                            Sasuke Uchiha  1 days back

                                                                                            Nun es ist ganz einfach.. wenn nicht alles wüsste an welchen Platz es zu stehen hätte würde man über eine bestimmte Anzahl an Nummern = Variabel von Erschaffungen nicht hinaus kommen.

                                                                                            • Jackson Starky
                                                                                              Jackson Starky  1 days back

                                                                                              Between this video and the "pi hiding in prime regularities" video, I'm hoping that there's a circular trajectory coming back around to the role of primes in the zeta function. I just finished re-reading "The Music of the Primes" by Marcus du Sautoy, and I'm wondering (thanks to this video) if there's a connection between the spirals in this video and the complex-plane spirals in the Riemann video around the 7-minute mark.