Why do prime numbers make these spirals?

8 okt 2019
2 760 370 Áhorf

A story of mathematical play.
Home page: www.3blue1brown.com
Brought to you by you: 3b1b.co/spiral-thanks
Based on this Math Stack Exchange post:
Want to learn more about rational approximations? See this Mathologer video.
Also, if you haven't heard of Ulam Spirals, you may enjoy this Numberphile video:
Dirichlet's paper:
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:
Stream the music on Spotify:
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 ISpast, if you want to stay posted on new videos, subscribe: 3b1b.co/subscribe
Various social media stuffs:
Website: www.3blue1brown.com
Twitter: twitter.com/3blue1brown
Reddit: www.reddit.com/r/3blue1brown
Instagram: instagram.com/3blue1brown_animations/
Patreon: patreon.com/3blue1brown
Facebook: facebook.com/3blue1brown

  • Beautifully visualized, clearly explained. Bonus: the plug for advanced education toward the end.

    David SyskoDavid Sysko4 klukkustundum síðan
  • Wormhole.

    LetysLetys8 klukkustundum síðan
  • The fact that 2.7 million people watched this gives me some hope for mankind.

    Christopher MaupinChristopher Maupin9 klukkustundum síðan
  • Easy Fix: Write the numbers in a line!

    DuesternisDuesternis12 klukkustundum síðan
  • Those spirals are fascinating and the explanations are amazing.

    Sun DaojunSun Daojun13 klukkustundum síðan
  • Everything is so much simpler when you understand that everything that exists was created and intended and dine with purpose by an infinitely intelligent creator. It's our privilege and joy to find the answers to the mysteries He gave us.

    James the BearJames the BearDegi Síðan síðan
  • Dave Rubin. You sound like Dave Rubin. I've been trying to place it for weeks lol

    Michael KilgoreMichael KilgoreDegi Síðan síðan
  • The Creator(of the universe) is an organised artist

    Julie JohnsonJulie JohnsonDegi Síðan síðan
  • 21:28 yes yes numbers are fun. its kinda correct and then pyramid measures was kinda planned i guess LOL everything related close enought. it all looks like planned LOL but what if not. will it mean end of life? if you layer that on US map what you see. was it planned?

    Jari SipilainenJari SipilainenDegi Síðan síðan
  • 6:15 thank alot NOT 1st and last are not lottery numbers but all rest are and do not never use them xD they not win, but diaconal will DID!!!

    Jari SipilainenJari SipilainenDegi Síðan síðan
  • Dude, you make me love Maths more and more every day

    Shreya GokhaleShreya GokhaleDegi Síðan síðan
  • The secrets of the universe are encoded in the first numbers. You just have to know how to read them, to obtain all the universal information available.

    joel ivan cittarjoel ivan cittarDegi Síðan síðan
  • I apologise for giving this a thumbs down, but there were 946 dislikes at the time of this comment, and I was not I the mood to see a non-prime number under this video.

    Jeff MurphyJeff Murphy2 dögum síðan
  • hey blue did you ever attempt solving one of the millennium problems? this looks like a clue to the Riemann problem for any mathematician out there you can win 1mil$

    BrunoBruno2 dögum síðan
  • You can make a religion out of this.

    NubyNuby2 dögum síðan
  • The unusual kendo ordinarily bang because ray bailly whisper during a irate baboon. terrific, bloody parallelogram

    Hunter WatkinsHunter Watkins2 dögum síðan
  • math hasn't made me this happy since 5th grade

    Ellie MäkeläEllie Mäkelä3 dögum síðan
  • Everyone who came here in this video are knowledge seekers.

    Dip BhowmikDip Bhowmik3 dögum síðan
  • Wow

  • i,m 844 mos. old ,4 goes into ,=211 see how it all works out.....hmmmm

    thomas dunhamthomas dunham3 dögum síðan
  • 13:52 Oh gosh I think I just got hallucinations from that

    Alex HandoAlex Hando3 dögum síðan
  • My brain is now frazzled

    Alan CliffAlan Cliff3 dögum síðan
  • Amazing...

    naruto 577naruto 5774 dögum síðan
  • SPIRAL OUT KEEP GOING oops, wrong spiral

    João MatheusJoão Matheus4 dögum síðan
  • The Primes were the original leaders of the autobots, who were benevolent, self-configuring robotic lifeforms. Whats all this about numbers?

    Kurt ReberKurt Reber4 dögum síðan
  • The null risk reciprocally sin because romania intrestingly tempt to a milky call. juvenile, tested wheel

    Nida ZuberiNida Zuberi4 dögum síðan
  • The summary at the end is so "spot on". It's humbling when you "discover" something that someone 200 years ago already figured, and also turned out to be half your age! But, it shows you still find numbers fun :)

    Shiraz EsatShiraz Esat4 dögum síðan
  • because you're twirling them?

    Luke ClelandLuke Cleland4 dögum síðan
  • I lost you at 14:30

    Dhruv TyagiDhruv Tyagi4 dögum síðan
  • The null sponge jointly kill because wound lally cure with a wholesale ghana. terrible, hideous high bottom

    wow2fast4mewow2fast4me4 dögum síðan
  • 7:10 - "And the reason we see only two of them when filtering for primes is that all prime numbers are either 1 or 5 above a multiple of 6, with the exceptions of 2 and 3." WHOA WHOA WHOA. You can't drop a fundamental fact like that without any explanation at all. _WHY_ are all primes equal to 6n + 1 or 6n + 5?

    Shawn ElliottShawn Elliott4 dögum síðan
    • It was explained just prior to that, starting at 5:45

      Релёкс84Релёкс844 dögum síðan
  • *how do you make the computer graphics for thises videos? They are not just cgi but rather real plots and real numbers not like theres a function in photoshop to do this especially with thousands of numbers all at the correct location* ?

    Dave BDave B5 dögum síðan
  • Totally irrational, the world is rational, no irrationals involved in reality. Have fun in the imaginary world. Volume of a sphere = exactly 5 times the base.

    yves lafluteyves laflute5 dögum síðan
    • That would be neat, but unfortunately it's just not correct.

      Релёкс84Релёкс845 dögum síðan
  • Mother Nature is simple...she draws no straight lines. everything is expressed in a curved linear reciprocating processional hyperboloid. look into fibonacci...1235...leaves out 4, which is time and does not exist as a thing--theoria aphophosis-look him up.

    Tom CollierTom Collier5 dögum síðan
  • Could we move on to third grade advanced calculus for the next video? Now where's the Tylenol???

    Cube FanCube Fan5 dögum síðan
  • awesome ......... but , 6 mins in and my ears are hurting with that "stupid spooky music" please let me know when there is a music free version as i would love to watch the rest , it's right up my lane , very sorry , pleaseeee and thanks , tom.

    Tom BowenTom Bowen5 dögum síðan
  • If you took the decimal away from pi (ie 314159...), would the infinite number be prime?

    Aaron B.Aaron B.5 dögum síðan
    • It's wouldn't be a valid number, because integers can only be written with finite digits.

      Релёкс84Релёкс844 dögum síðan
  • Shouldn't there also be a point like that with 16 noticeable spirals? 16/pi is about as far from an even number of rotations as 6/pi is. Why doesn't that also seem to be the case?

    Schadrach42Schadrach425 dögum síðan
  • Cool, but they can be arranged differently. Arranging things in different orders can give rise to interesting patterns which sometimes we can take advantage of. But, it should be taken into account that numbers can be arranged in very different ways with very different results. For example, why use base 10? Honestly the base 10 is not the most logical best base to use. We use it because of an arbitrary decision which is strongly related to the fact we have 8 fingers and 2 thumbs which means we can easily count to 10 with our two hands. But, historically humanity has used many other bases. A base which is 2^n where n is a natural number is better, i.e. 2, 4, 8, 16, 32, 64, etc. Of these, for our current level of intelligence, 8 is too simple and 32 is too complex, thus the base of 16 would likely be the best base. Another is, why plot these values in polar coordinates for the Cartesian coordinates (prime, prime). What about (prime, 1)? What about making patterns using Cartesian coordinates or spherical coordinates? Mind you, I am in no way saying there are not interesting things we can learn by forming numbers in a pattern like the one in this video, because clearly we can and that is a good thing. But, we should not forget to make other patterns and look for other interesting results from doing so.

    Aristotle StagirusAristotle Stagirus5 dögum síðan
  • Are you robot?

    GodspeedheroGodspeedhero5 dögum síðan
  • Mathematicians: "Mysteries of the universe? Hmph, there are no such things. Mathematics has all of the answers.... What was that? "Miillenium" what? Nonsense! I've never heard of such a thing!"

    GodspeedheroGodspeedhero5 dögum síðan
  • How did you make this video without mentioning Euler even one time? I'm amazed. I spoke 1min too soon. lmao Sorry for doubting you!

    GodspeedheroGodspeedhero5 dögum síðan
    • Haha!!

      Dhruv TyagiDhruv Tyagi4 dögum síðan
  • "together with the angle that that radial line makes with the horizontal"

    bravelittleroombabravelittleroomba6 dögum síðan
  • The boiling laundry supposedly file because close arespectively flow on a incompetent slime. eatable, stiff flag

    sam smithsam smith6 dögum síðan
  • wormhole?

    robiandolorobiandolo6 dögum síðan
  • Cool video. At first I thought, OMG! Symmetry among primes! Then you explained, and I quickly saw, that it was an illusion. Nice!

    Mickey BitskoMickey Bitsko6 dögum síðan
  • these spirals are really cool. wish i understood it. does this suggest that by extending these spirals way, way out we can identify really, really REALLY large prime numbers in a simple way ?

    John PapishJohn Papish6 dögum síðan
    • This video mentions Dirichlet's theorem, which basically says that no, you cannot find primes more easily through this.

      Релёкс84Релёкс846 dögum síðan
  • what if we used a number system based on pi rather than the decimal system?

    Elie MakhloutaElie Makhlouta6 dögum síðan
  • The disgusted wallet biophysically choke because blowgun endoscopically impress below a oafish sled. eight, scarce share

    kurt Morakurt Mora6 dögum síðan
  • Will the prime ever be exactly 2pi

    NisrashaNisrasha6 dögum síðan
    • @Релёкс84 Thank you

      NisrashaNisrasha6 dögum síðan
    • No. Because if it ever did, the you would have found a way to write 2pi as a ratio of to integers. But that is impossible as 2pi is known to be irrational, so it will never happen.

      Релёкс84Релёкс846 dögum síðan
  • Doesn't it all have to do with our number system being 10-digit based? What would other number systems, with different iteration intervals, do to things like the mandelbrot set? Like counting in groups of 9 or 4, that would affect prime number sequence

    lucabaar1lucabaar17 dögum síðan
    • it has nothing to do with the way you write numbers. these are properties of the numbers themselves, independently of how you write them.

      Релёкс84Релёкс846 dögum síðan
  • vortex maths. we learn this in junior school back on vulcan

    Mathew SmithMathew Smith7 dögum síðan
  • 22 Minutes of useless information, and yet, I am not mad having invested them.

    R. K.R. K.7 dögum síðan
  • I did not understand half of the math here but still find this incredibly interesting and fascinating

    Michals_Michals_7 dögum síðan
  • If you zoom the pattern out far enough, it forms the trademark stamp of UniCosmos Anachtakarg, the company that designed and manufactured our Universe in the first place (and many other Universes).

    Rep0007Rep00077 dögum síðan
  • The chief sociology jointly transport because magician worrisomely agree underneath a lyrical branch. diligent, garrulous paul

    Sam WangSam Wang7 dögum síðan
  • Great video, thank you so much !

    Bernard AbrialBernard Abrial7 dögum síðan
  • There are not an infinite amount of primes, and I think I can prove it

    Immortal ZoDDImmortal ZoDD7 dögum síðan
    • @Immortal ZoDD While it's true that the "density" of prime numbers decreases the further you go (which is provable but harder to prove) that does not mean at all there is a finite number of them. Also, the sum of 1/n over all integers is not a finite number: it diverges to infinity. Just the fact that a sequence of numbers approaches zero *does not* mean its sum is finite, and this is a very important result. I'm not going to tell you the proof prime numbers are infinite just yet because it's much better for you if you work it out yourself, but I'll give you a clue on where to start: imagine you have a set which contains a finite number of prime numbers - it doesn't matter how many there are or which one they are, just asl ong as it's a finite group of primes. Now consider the number which is defined as the product of all those primes + 1. For instance, if your set contains 2, 3 and 5, this number will be 2x3x5 + 1 = 31. Now the question is: is this number prime? How can you tell? The answer to this question is not trivial, but finding it will definitely put you on the right path to understand why there are infinitely many primes. If you don't understand how to proceed I'll gladly give you the full reasoning but it's much better if at least you give it a try.

      Релёкс84Релёкс847 dögum síðan
    • @Релёкс84 yeah, I meant a video explaining the proof, much like this one. I'm thinking of plotting prime number frequency, and I imagine at one point it will reach zero. I'm thinking it could be similar to how the sum of 1/n for n = 1 to infinity is a finite number

      Immortal ZoDDImmortal ZoDD7 dögum síðan
    • @Immortal ZoDD Mathematicians don't prove things with videos. I don't know of a video about this, i just know the argument. But if you look up "infinite primes proof" on youtube you'll surely find a lot of results. I'd be glad to hear your reasoning though.

      Релёкс84Релёкс847 dögum síðan
    • @Релёкс84 I bet there's video proof. Can you point me in the right direction? Want to see if my guess can hold any water

      Immortal ZoDDImmortal ZoDD7 dögum síðan
    • it's easy to prove there is an infinite number of primes.

      Релёкс84Релёкс847 dögum síðan
  • **Looks at thumbnail** **Looks at title** Me: I don't know man, kinda looks like spiral energy from Gurren Lagan.

    AxolitionAxolition8 dögum síðan
  • 12:40 this reminded me of a fingerprint. They also do have spirals. It´s always fascinating to discover mathematical structures and phenomena in nature

    CarachoCaracho8 dögum síðan
  • Man, your work is beautiful.

    Gary GallagherGary Gallagher8 dögum síðan
  • Apenas a los 6 minutos de vídeo me empeze a dar cuenta que no entiendo ni madres porque está en inglés

    Edgar Jesus Moreno CastañedaEdgar Jesus Moreno Castañeda8 dögum síðan
  • (I haven't watched the video to the end yet, and I should add that english isn't my language and that I have dyscalculia; Still I'm enormously fascinated by patterns! And I heard of Fibonacchi numbers and golden cut and golden angles and the nature artworkpatterns of Daysies, Sunflowers, Pinecones and at 4:03 your pattern beginns to look exactly like those! I was soo excitet ! I have tried to recreate such a spiral with a similar drawing like your polar coordinates radius circles and lines grid thingy and wondered why this pattern had anything to doo with numers ?? (1+1=2, 2+1=3, 3+2=5, 5+3=8, 8+5=13) BUT AT LAST I get to see the reason. Pictures say so much more than words (or numbers). MERCI BEAUCOUP to you !

    Alexandra WimmerAlexandra Wimmer8 dögum síðan
  • Because primes exist at the gaps between multiples.

    PsyberSourcererPsyberSourcerer8 dögum síðan
  • Thats why I have observed primes is a good tool for creating (musical) rythms ;)

    MLC FononMLC Fonon9 dögum síðan
  • Learning every day.Thank's!

    Ritvars RolisRitvars Rolis9 dögum síðan
  • PRIME number is the foundation of CREATION. The human MIND is constructed by Prime Number Matrix Grid. It is an unconscious KNOWING that NEW Ager refer ALL that is the PRIME CREATOR - INDEED. Currently we are at the 6th Prime, 13D and heading to the 7th Prime, 17D. Or it could be we already pass the 8th Prime 19D and heading to the 23D, 9th Prime in MIND. After that the path go backwards to the 7th PRIME and a heaven on earth will reflect on the OUTSIDE. IT is how TIME ( consciousness) moves.

    Wanju ChienWanju Chien9 dögum síðan
  • Beautiful. It is interesting that number 6, 44 etc play a pivotal role. In polar plot of Natural numbers, 6 is close to 2pi with a bit of residue and hence the 6 streaks. And 6x + 1, 6x - 1 series are prime numbers and hence only 2 streaks of the 6 are prime.

    Sujatha RatnalaSujatha Ratnala9 dögum síðan
  • @ 0:04 I immediately clicked out of the video.

    Jake KeeneJake Keene9 dögum síðan
  • 1:03 why does the radius expand even tho it should stay at 3? puts the whole vid ad absurdum.

    Hugin PhosphorHugin Phosphor9 dögum síðan
  • If it look like spiral, it is available transfer to sine wave ?

    Kyeong woo JeongKyeong woo Jeong10 dögum síðan
  • 2:14 Jojo fans: hey, I know that guy!

    Mateo AravenaMateo Aravena10 dögum síðan
  • One thing I learned from having a super-smart boss try to teach me algebraic topology is that these patterns are failry arbitrary and largely a product of how we choose to map / graph the data.

    Railgap EsotericaRailgap Esoterica10 dögum síðan
  • You inspire me sir!

    Michael BrownMichael Brown10 dögum síðan
  • 4:08 my disappointment is immeasurable and my day is ruined. Why would you start it like that?

    Ignacio RocaIgnacio Roca10 dögum síðan
  • What if pi was a different value? Would this change anything? I have a way to calculate Pi with accuracy from the left to the right. I haven't gone more that 9 decimals deep but my understanding of what the value is, is: 3.141578444 Phi is: 1.617836463 I can go further but it takes a lot of space to write it out, if anyone could help me with writing a spreadsheet it could be done with a computer rather quickly...

    Timothy AgopianTimothy Agopian11 dögum síðan
  • Is there a way NOT to get spirals?

    G KessG Kess11 dögum síðan
  • Why is 25 on the chart of primes?

    Mike ClarkeMike Clarke11 dögum síðan
  • Encause we are magnetically drawn to the core of Gods heart, three kingdoms pi and golden ratio are the order we left the order we go back joined is spiral infinity

    Blanca ConejoBlanca Conejo11 dögum síðan
  • This makes me like math for once..

    Sophia StarksSophia Starks11 dögum síðan
  • rocky or bullwinkle?

    R RR R11 dögum síðan
  • This man is jesus

    Daniel MarvinDaniel Marvin12 dögum síðan
  • I dont have any interest in Math and I dont fully understand this, but its so Entertaining to watch, Thank you!

    Pumk!nPumk!n12 dögum síðan
  • A "totient" function, here written between totation marks, is not a totidian problem.

    fglebrefglebre12 dögum síðan
  • The word beautiful cant even describe how beautiful that shit is. This video made me feel like im high.

    Valentin BergValentin Berg12 dögum síðan
  • The zero is actually creating primes ! Diabolic decimal system :)

    Great BulletGreat Bullet12 dögum síðan
    • The existence and value of primes is competely independent from the way you write numbers.

      Релёкс84Релёкс846 dögum síðan
  • they dont

    SyracaxSyracax12 dögum síðan
  • Awesome explanation 👍🏼❤️

    Deepa RaoDeepa Rao12 dögum síðan
  • Any chance you can do me a huge favor? I need a visualization of a base 3 number system prime number spiral. Show me prime numbers in a projection, using a base 3 system. =)

    Rumple StilskinRumple Stilskin13 dögum síðan
    • The base you write them in doesn't change how it looks. That's because you draw them, not write them.

      Релёкс84Релёкс8411 dögum síðan
  • I have two questions... I wrote small program to find cases when the result of the next step is closer to a integer number of full turns than ever before.That's what I've got. 1 radian is about 0 full turns, the difference is 1.0 6 radians is about 1 full turn, the difference is -0.28318530717958623 19 radians is about 3 full turns, the difference is 0.1504440784612413 25 radians is about 4 full turns, the difference is -0.13274122871834493 44 radians is about 7 full turns, the difference is 0.017702849742896376 333 radians is about 53 full turns, the difference is -0.008821280518098717 710 radians is about 113 full turns, the difference is 6.028870677710074E-5 103993 radians is about 16551 full turns, the difference is -1.912933227998792E-5 312689 radians is about 49766 full turns, the difference is 2.9007205739617348E-6 1980127 radians is about 315147 full turns, the difference is -1.725052491963197E-6 2292816 radians is about 364913 full turns, the difference is 1.1757947504520416E-6 4272943 radians is about 680060 full turns, the difference is -5.497234027984632E-7 Well, I got 1, 6, 44 and even 710, the numbers of steps which about you spoke But 19-, 25- and 333-groups of spirals just become lost among the others. T hat's why I have those two questions. 1) Which spirals would we see? 2) Is set of these numbers endless? P.S. I'm sorry for my English, I am Russian :) I would be grateful if you could check me :)))

    Дмитрий ЛяпинДмитрий Ляпин13 dögum síðan
    • Yes this sequence of numbers is endless, because you can get as close as you want to pi using rational numbers, but never reach it since it's irrational.

      Релёкс84Релёкс8411 dögum síðan
  • kudos to the animator of this video

    Thanakrit GuThanakrit Gu13 dögum síðan
  • We can draw use prime number, see my video

    EdiKurn_EdiKurn_13 dögum síðan
  • Phenomenal. Perfect. Pleasantly presented.

    MarqMarq14 dögum síðan
  • The frequent grill rhetorically use because front strangely calculate above a abusive example. gigantic, grubby gruesome bridge

    Connie PrudeConnie Prude14 dögum síðan
    • Man, they are here too?

      Релёкс84Релёкс8411 dögum síðan
  • Ah, damn, just had it thrown down my throat that I am thick as pig poo. I thought I was, sort of, moderately bright.... then got 5 minutes into this and just zoned. Jeez.

    Steve KirkbySteve Kirkby14 dögum síðan
  • The calm adapter electrophysiologically support because season preclinically peep behind a utter cupcake. crowded, voracious drill

    Neth WinklesNeth Winkles14 dögum síðan
  • Hmm doesn't this mean you solved fermats last theorem?

    Nicol BolasNicol Bolas14 dögum síðan
  • So... If you zoom out even more, you will get new spirals everytime, and each time they will be less "spiraled", meaning you got a new rational approximation for π that is more accurate than the one before..? Right? *mindblow* EDIT: When zooming tends to infinity, you would spect to visualize perfectly straight lines that arise from the origin, as you got an infinite rational approximation to π

    Martín Elosú DietzMartín Elosú Dietz15 dögum síðan
  • 3Blue1Brown - it was necessary to write not "Why do prime numbers make these spirals? ", but the behavior of numbers in displacement or in a circle

    ACTIONKEYACTIONKEY15 dögum síðan
  • I have never seen numbers this beautiful in my life that it made me tear up

    pls argue with mepls argue with me15 dögum síðan