Prime Spirals - Numberphile

  • Published on Jul 9, 2013
  • Prime numbers, Ulam Spirals and other cool numbery stuff with Dr James Grime.
    More links & stuff in full description below ↓↓↓
    James Clewett on spirals at:
    And more to come soon...
    * subscribing to numberphile does not really change your physical appearance!
    And "golden line" in this context was made up by Brady!
    Numberphile on Facebook:
    Numberphile tweets:
    Videos by Brady Haran
    Brady's videos subreddit:
    Brady's latest videos across all channels:
    Sign up for (occasional) emails:
    Numberphile T-Shirts:
    Other merchandise:
  • Science & TechnologyScience & Technology

Comments • 1 673

  • TeeTerTime
    TeeTerTime 3 days ago +1

    G2 wins the invitational and Pengu is over here talking about numbers!

  • mamaboo cee
    mamaboo cee 3 days ago

    I love primes...

  • Mehico2fel
    Mehico2fel 6 days ago

    Are those random numbers was odds?

  • medexamtoolsdotcom
    medexamtoolsdotcom 6 days ago

    I don't see why it would be a surprise that there would be certain lines that are heavier or lighter than others. For instance mark off the lines where the multiples of 3 are, and there will of course be NO primes on those lines. Same with 5's. So rather than being uniform, there will be those lines where there is nothing at all. Well, you superimpose a bunch of things like that together, with things being fainter in some lines and darker in others, and I would expect to get something just like this.

  • Ken Taylor
    Ken Taylor 8 days ago

    I did this with a fibonacci snowflower spiral. There are some spirals here of odd numbers without primes present.

    • Ken Taylor
      Ken Taylor 8 days ago

      I think these are the product of two odd numbers.

  • Daniel A Millar
    Daniel A Millar 9 days ago

    Did the random one exclude evens? I’m not doubting that prime numbers aren’t totally random, but I do wonder if that visual example is disingenuous.

  • Faic Legion
    Faic Legion 9 days ago

    Oh I remember doing this

  • Brian Tepper
    Brian Tepper 12 days ago

    Curious if there are any other types of spirals that show other interesting patterns when filled in with primes

  • Wagner Lip
    Wagner Lip 20 days ago

    Trying to make a visual image that justify more patterns for primes, but we don't know primes. In real, we do know what is NOT primes, so we could make a pattern for those, and perhaps, primes start to appear easier. Also, spirals induce to a sequence of logic quantification, primes do not follow that pattern, we already know that, so why follow that path?

  • Neko Master
    Neko Master 22 days ago

    why not fractal

  • Yiyi Wu
    Yiyi Wu 25 days ago +1

    It is obvious why the “stripes” pattern exists. It’s because in this layout odd vs even numbers form sort of a chessboard. Besides 2 every prime is odd. Even though not every odd is prime our brains will notice the pattern created by only numbers of one “color” on the chessboard being illuminated

    • Yiyi Wu
      Yiyi Wu 25 days ago +1

      In other words the only way he has refined the search for primes is to not include even numbers! Also seems silly to compare to randomness

  • Cracked Emerald
    Cracked Emerald 26 days ago

    I think that we need to discover another type of number to fully understand primes

  • Arcadio Arcadio
    Arcadio Arcadio 28 days ago

    Probably if someone would use a 3, 4 or 7-dimensional base the pattern would be just a straight line, the line of truth connecting past with the future, a thread of the unknown realm. Maybe AI automatic algorithms will solve this.

  • Joe Harris
    Joe Harris Month ago

    "And ye shall know them by their stripes."

  • Emilio Arroyo Mohamed

    Try again the spiral without even numbers and see if there are still stripes

  • Omegacat13
    Omegacat13 Month ago

    Hello from the future! You might want to sit down, I have a lot of things to warn you about. Like a lot, a lot.

  • OceanSky Web Design

    You would really love this book. I did. Peter Plichta illustrates how the prime numbers are ordered on concentric circles numbered 1 to 24 and then 25 to 48 and so on; expanding outward like cross shaped rays of sunlight radiating outward. The guy was a genius!

  • Fracmik
    Fracmik Month ago

    Maybe plugging primes into the equation is the way to obtain more? Just a random idea from a not-advanced-educated viewer

  • Little Cripple
    Little Cripple Month ago

    My favourite pattern is whenever you put all the primes in a spiral, and whenever you highlight all primes, you get a completed spiral. Pretty cool huh

  • Prabhat Soni
    Prabhat Soni 2 months ago

    Great visuals!

  • Kim Welch
    Kim Welch 2 months ago

    So, you're doing a bunch of 2-dimensional spirals. Have you looked at 3-dimensional or 4-dimensional spirals. Yes, it's really hard to do on paper, but some of the 2d stuff you're showing look like projections from a larger dimensional shape.

  • Casey
    Casey 2 months ago

    Has anyone searched for the opposite of the golden diagonals, with the lowest density of primes?

  • Angela Garet
    Angela Garet 2 months ago

    Primes frequency is moving away from perfect squares, cubes, etc.

  • Shruggz Da Str8-Faced Clown

    It also appears that, within the grid of this square spiral, there is a preponderance of contrasting horizontal and vertical lines whereupon non-primes lie.

  • bnkjkdsbklafj hjbvjhbfdasjka

    if you skuint at it you can see stripes in the random patern
    but they aren't as vibrant, dense and long as in ulam's spiral

  • Engineer Asik
    Engineer Asik 2 months ago

    any sequence having general term tn=an²+bn+c where a,b,c are constants is called quadratic sequence

  • Engineer Asik
    Engineer Asik 2 months ago

    that quadratic polynomial is the general term for the quadratic sequence

  • huckbeduck
    huckbeduck 2 months ago

    I found an equation to find the next number, going diagonally or horizontally or vertically. (This is for all the numbers to create an ulam spiral without writing every digit). Just add 8 to the difference between two of the previous consectutive numbers of the direction you want to go. 2,10,26,50 is a diagonal for example; (50-26=24, 24+8=32, 32+50=82. "82" is the next number in the sequence.

  • Soreofhing
    Soreofhing 2 months ago

    1:16 "He was sat...". "He was seated...". There. Fixed it for you.

  • kirigata
    kirigata 2 months ago

    I wonder what those lines would look like if plotted in 3d. instead of using a square for the spiral, try a cube?

  • Simon Shugar
    Simon Shugar 2 months ago

    3:10 Wouldn't it be better to compare the prime spiral to random ODD numbers chosen instead of ALL numbers? Odds are all diagonal from each other in this spiral so it may just be that that we're seeing.

  • Max Musterman
    Max Musterman 3 months ago

    Need help. Is there a way to get the (x,y) position of any number? 1 has (0,0).

  • Supernova
    Supernova 3 months ago

    That's amazing! I love this!

  • Shivam Mishra
    Shivam Mishra 3 months ago

    The line equation is a parabolic eqn , which in the second diagram seems to be a spiral

  • The Fourth Musketeer
    The Fourth Musketeer 3 months ago

    I was doing some math and found that (2n)+(n^2)-1 created primes very well if n is even. Example: (2 x 99922222222220)+(99922222222220^2)-1 is prime. I also saw that up to 200 being n (leaving out odd numbers) it spit out a prime 42% of the time.

  • ryavix
    ryavix 3 months ago

    Now if only we could get these over educated folks to STOP thinking 2 dimensionally.

  • Mondo LeStraka
    Mondo LeStraka 3 months ago

    Love this!!

  • Andriy Makukha
    Andriy Makukha 3 months ago

    Ulam comes from Lviv, one of the most beautiful cities in Ukraine. There are places that he used to visit with his math buddies.

  • Krishaang Kohli
    Krishaang Kohli 4 months ago

    James showing his true 'attraction' for primes
    "Look at these curves."

  • BigMan Ollie
    BigMan Ollie 4 months ago

    what would happen if you were to do this with other tessellating shapes? i.e. filling in a spiral on a map of hexagons etc..?

  • saqqaq _
    saqqaq _ 4 months ago


  • K GN
    K GN 4 months ago

    Great video! Thanks.

  • Svsnmurty Gattimi
    Svsnmurty Gattimi 4 months ago

    I am working on Composite Numbers factors based on normal Algebra and Geometry( not divide 1,2,3,..). I need One composite number with unknown factors to find factors based on my work. please help anyone.

  • Caden Bintliff
    Caden Bintliff 4 months ago

    i eat children

  • Velma Velvet
    Velma Velvet 4 months ago

    The round one reminds me of the Earth's magnetic field.

  • Toph Morris
    Toph Morris 4 months ago

    4:49. So, when x=4, the result isn't prime? That somehow seems logical to the degree of being obvious, but I suppose it isn't since there's a +1 in the formula itself. I want to experiment with this now and see the values of x that give you prime numbers and those that don't, and compare/contrast. I can't imagine this already hasn't been done, though. Moments like this, I hate being a math pleb.

  • Robert Morgan
    Robert Morgan 5 months ago

    What if you only circle the mersenne primes?

  • Brandon Gammon
    Brandon Gammon 5 months ago

    What would a square spiral of just prime numbers look like???

  • jat green
    jat green 5 months ago

    ok, i'm writing a computer program to go in spirals checking for diagonal lines and predicting primes and checking if they are. i really want to see how many primes it comes up with and how fast it is compared to a simple primes checker that checks every number

  • Steven Wenker
    Steven Wenker 5 months ago

    Please zoom out a little bit

  • Brandon Hamer
    Brandon Hamer 5 months ago

    I wonder what it would look like if you did ulams spiral but coloured numbers according to how many prime factors each number has. All primes would be one colour, then numbers like 6, 10, 14 and 15 another colour and 8, 12, 18 and 20 another and so on. I tried looking to see if someone had done this but couldn't find anything.

  • Nin compoop
    Nin compoop 6 months ago


  • Robi_CK
    Robi_CK 6 months ago

    0:58 - Kudos for pronouncing Stanisław right, with "ł" not "l".

  • Timothy Hinkle
    Timothy Hinkle 6 months ago

    if you repeated this same experiment in more than 2 dimensions what are the results? 2,3,4...26

  • Jake Mooshian
    Jake Mooshian 6 months ago

    I would like to see Ulam's spiral using only odd numbers.

  • Nikhil Nirmal
    Nikhil Nirmal 6 months ago

    Must watch Channel Nikhil Nirmal
    Prime numbers identification easily .

  • Corpus Crewman
    Corpus Crewman 6 months ago

    I love how the primes graphed along the Archaemedian spiral result in figures that resemble logarithmic graph functions.

  • Luis Padua
    Luis Padua 6 months ago

    I'd like to see a video on the standard model lagrangian density formula.

  • Jack Kidd
    Jack Kidd 6 months ago

    what if you write the numbers in triangles, or pentagons, or hexagons....instead of a square

  • Hamza147
    Hamza147 7 months ago

    Amazing ! You remind me some of my discussions about prime numbers with a dear friend of mine when we were at high-school.

  • Axe
    Axe 7 months ago

    Long ago, I've found two interesting formule for primes: sqrt(120n+1) and sqrt(120n+49).
    For quite a lot of values of n, whenever the formula's output was an integer, it was prime. What's more, the first formula returned primes ending in 1 and 9, and the second - in 3 and 7. I haven't calculated the breakdown point (value of n where the formula returns a non-prime integer) due to lack of experience in number theory, but it seems to be quite high. Could you please look at that? Maybe not in a video, but is there any research done on this already?

  • Kai Na
    Kai Na 7 months ago

    Well primes are odd, so it appears normal to see stripes if you arrange numbers in a spiral, since odd and even numbers are intertwined

  • Venkatesh babu
    Venkatesh babu 8 months ago

    1=√1=√1/1=√1/√1=1/√1=√1×√1=- i^2 = ... , So Fibonacci series is powers of i.

  • David Tribble
    David Tribble 8 months ago

    What's so special about the primes?
    I've wondered for many years now if primes can be considered just a special case of the set of naturals having 2 divisors, Sd(2) = {2, 3, 5, 7, 11, ...}, where the next set is the naturals having 3 divisors Sd(3) = {4, 6, 9, 10, 14, 15, ...}, and so on for Sd(4), Sd(5), etc. Sd(1) is just {1}, of course. The trick, then, is to find numeric relationships between Sd(i) and Sd(j), and then generalize these to all Sd(n, for all n in N).

  • S. Smith
    S. Smith 9 months ago

    A similar concept I came up with while doodling in school too...
    Get grid paper, and do rows, draw lines through primes; they line up at various different angles

  • He Fr
    He Fr 9 months ago

    "look at those curves" -James Grime

  • Algorithm
    Algorithm 9 months ago

    I used this exact concept in 5th grade when I was just playing around with primes and trying to figure out a pattern. It's interesting to see that there is actually a pattern as I didn't notice anything when I did it. I only went up to 100 though.

  • AlekVen's stupidface
    AlekVen's stupidface 10 months ago

    You know that if you write down numbers like that, every diagonal will either contain strictly odd numbers, or even numbers, and they'll follow each other?
    Of course you'll see the pattern of primes considering that, excluding 2, every single one of those is odd, thus only lie on certain diagonals.

  • Nathan 1132
    Nathan 1132 10 months ago


  • Nathan 1132
    Nathan 1132 10 months ago

    il é ou gotaga ?

  • Nathan 1132
    Nathan 1132 10 months ago

    go 1vs1 fortnite

  • Nathan 1132
    Nathan 1132 10 months ago


  • Frank Harr
    Frank Harr 10 months ago

    You know, the primes may or may not have a patter, but the non-prime DEFFINATELY have a pattern.

  • A. Joe
    A. Joe 10 months ago

    The primes in the Archimedian spiral look very much like parabolic functions rotated 90 degrees to the left. Has anyone investigated whether there may be a complex rotation of a second order polynomial involved in creating this pattern?

  • Дмитрий Кузнецов

    I wonder if anyone tries to do real math in some other system of calculation different from decimal. may be those patterns could be seen even easier.

  • Aaron Rotenberg
    Aaron Rotenberg 10 months ago

    What do you mean 57 isn't prime? Everyone knows it's the Grothendieck prime!

  • Denis SEO
    Denis SEO 10 months ago

    So on some visual representation you can get a straight line of primes going into infinity?

  • z
    z 10 months ago

    james prime

  • thebudkellyfiles
    thebudkellyfiles 10 months ago

    Thank you for so many great and interesting videos.

  • paperEATER101
    paperEATER101 11 months ago

    I see Elvis in the "random" picture

  • Meph
    Meph 11 months ago

    It kinda looks like a swastika. I wonder if math is trying to tell us something.

  • nightmisterio
    nightmisterio 11 months ago

    Do prime visualization in base 12

  • Ted Rowell
    Ted Rowell 11 months ago

    Can someone make one of those squares where all the even numbers are in the correct location, and all the odd ones random? I wonder what that would look like.

  • Leo Yohansen
    Leo Yohansen Year ago

    Compare it with the graph for 6x + or - 1.

  • Xa
    Xa Year ago

    It seems to me that the reason the prime numbers form diagonal lines is just because they're odd. After all, if you circle all the odd numbers instead of the prime numbers, you'll get a checkerboard-like grid. Naturally, since prime numbers, besides 2, are odd, they will tend to form random diagonal lines.

  • Coco Puffs
    Coco Puffs Year ago

    x^2 + x + [button smash your calculator here]

  • RBWN
    RBWN Year ago


  • Osanne
    Osanne Year ago

    Could the pattern of diagonals (partially) be caused by the fact that prime numbers except two are always odd numbers?
    In such a spiral notation the odd and even numbers immediatly form a grid of odd and even number lines, and prime numbers can already only exist on half of those.
    So the difference from a completely random pattern is already visible the moment you say "the random numbers cannot be even". I doubt there would be a clear difference between odd random numbers and prime number patterns.

  • MisterNewOutlook
    MisterNewOutlook Year ago

    Have these spirals been tried on a sphere or within a sphere?

  • Chris Larson
    Chris Larson Year ago

    The cause for the diagonals appearing in the prime spiral as opposed to the chaos in the randomly generated picture is because the prime spiral creates a checkerboard between evens and odds. Essentially, if you took the random pictures and then removed all of the even, my hypothesis is that it would look similar to the prime spiral with respect to the prevalence of diagonals

  • Gunihelm Schaf
    Gunihelm Schaf Year ago

    I found a equation who gives u every prime number

  • Patryk Wieczorek
    Patryk Wieczorek Year ago

    Maths is beautiful!

  • ScarletFox
    ScarletFox Year ago

    What if we're thinking of this wrong.
    Every pattern like this creates a line in which no primes are possible.
    Maybe the primes are the gaps where every one of these lines from every possible pattern doesn't cover.

  • Paul White
    Paul White Year ago

    Wanna see how to find primes ? them onto a set of concentric circles of 24 sections each . Each section represents one sequential natural number and keep going for each larger circle. You will find them only on 8 " rays " from the centre. All very geometric .See prof. Dr. Peter Plichta's book ...god's secret formula. I believe the formula 6n + 1 or - 1 ,might be worth looking into. Cheers all

  • Sander
    Sander Year ago

    I'd like to see that picture of random numbers, but with the added rule that all even numbers other than 2 are excluded. This because the picture is now also filled with horizontal and vertical stripes while in the Ulam's spiral it is by definition only possible to form stripes that are diagonal.

  • CornerTalker
    CornerTalker Year ago

    Try putting the digits of pi in an Ulam's spiral and then marking the primes.

  • magnusee
    magnusee Year ago

    Dont do it in a grid. Try a honeycomb pattern

  • John Perkins
    John Perkins Year ago

    I would like to see the spiral with the obvious diagonals removed, then see if other diagonals become apparent.

    ROVAKAN Year ago

    where can i get those pictures of spirals please ?

  • Ismir Eghal
    Ismir Eghal Year ago

    0:23 rap career secure if maths should one day not
    work for him anymore