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 652

  • BigMan Ollie
    BigMan Ollie 3 days 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 days ago


  • K K
    K K 4 days ago

    Great video! Thanks.

  • Svsnmurty Gattimi
    Svsnmurty Gattimi 10 days 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 12 days ago

    i eat children

  • Velma Velvet
    Velma Velvet 15 days ago

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

  • Toph Morris
    Toph Morris 20 days 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 20 days ago

    What if you only circle the mersenne primes?

  • Brandon Gammon
    Brandon Gammon 21 day ago

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

  • jat green
    jat green Month 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 Month ago

    Please zoom out a little bit

  • David Smith
    David Smith Month ago

    thats no spiral

  • Brandon Hamer
    Brandon Hamer Month 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 Month ago


  • Robi_CK
    Robi_CK Month ago

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

  • Timothy Hinkle
    Timothy Hinkle Month ago

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

  • Jake Mooshian
    Jake Mooshian 2 months ago

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

  • Nikhil Nirmal
    Nikhil Nirmal 2 months ago

    Must watch Channel Nikhil Nirmal
    Prime numbers identification easily .

  • Corpus Crewman
    Corpus Crewman 2 months ago

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

  • Luis Padua
    Luis Padua 2 months ago

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

  • Jack Kidd
    Jack Kidd 2 months ago

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

  • Hamza147
    Hamza147 3 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 3 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 3 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 3 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 4 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 4 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 5 months ago

    "look at those curves" -James Grime

  • Algorithm
    Algorithm 5 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 5 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 5 months ago


  • Nathan 1132
    Nathan 1132 5 months ago

    il é ou gotaga ?

  • Nathan 1132
    Nathan 1132 5 months ago

    go 1vs1 fortnite

  • Nathan 1132
    Nathan 1132 5 months ago


  • Frank Harr
    Frank Harr 5 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 6 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 6 months ago

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

  • Denis SEO
    Denis SEO 6 months ago

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

  • z
    z 6 months ago

    james prime

  • thebudkellyfiles
    thebudkellyfiles 6 months ago

    Thank you for so many great and interesting videos.

  • paperEATER101
    paperEATER101 6 months ago

    I see Elvis in the "random" picture

  • Sodium Hypochlorite
    Sodium Hypochlorite 7 months ago

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

  • nightmisterio
    nightmisterio 7 months ago

    Do prime visualization in base 12

  • Ted Rowell
    Ted Rowell 7 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 7 months ago

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

  • Xa
    Xa 7 months 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.

  • DJ Q
    DJ Q 7 months ago

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

  • RBWN
    RBWN 7 months ago


  • Osanne
    Osanne 7 months 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 7 months ago

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

  • Chris Larson
    Chris Larson 8 months 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 8 months ago

    I found a equation who gives u every prime number

  • Patryk Wieczorek
    Patryk Wieczorek 8 months ago

    Maths is beautiful!

  • ScarletFox
    ScarletFox 8 months 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 8 months 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 8 months 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 9 months ago

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

  • magnusee
    magnusee 9 months ago

    Dont do it in a grid. Try a honeycomb pattern

  • John Perkins
    John Perkins 9 months ago

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

    ROVAKAN 9 months ago

    where can i get those pictures of spirals please ?

  • Ismir Eghal
    Ismir Eghal 9 months ago

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

  • Computerman 21
    Computerman 21 9 months ago +1

    7:08 is a fingerprint

  • Anonyme Anonymes
    Anonyme Anonymes 9 months ago

    Excellent video

  • Marcelo Fernandes
    Marcelo Fernandes 10 months ago

    @Numberphile The patterns at @7:13 are very similar to potential flow lines around a horizontal flat plate!

  • VITA kyo
    VITA kyo 10 months ago

    Try an hexagonal pattern instead of squares

  • Jesse Leonard
    Jesse Leonard 10 months ago

    This guy and a dirty chalkboard goes hand in hand. Ugh I love numberphiles

    • Jesse Leonard
      Jesse Leonard 10 months ago

      If I found them in college I wouldn't have failed any math classes

  • AraChan
    AraChan 10 months ago

    Pucci aproves

  • Oqsy
    Oqsy 10 months ago

    If you keep going with the second arrangement you realize that the “basketball” is just the beginning of a pattern that looks like:


  • Banjon Pro
    Banjon Pro 10 months ago

    Do all mathematicians truly believe that we are in a simulation, or is it just me? It's hard to find arguments against it.

  • Khalid Salah
    Khalid Salah 10 months ago

    who's here for advent of code'17 day 3?

  • Erika Vega
    Erika Vega 10 months ago

    Love this guy!

  • My Life In A Nutshell
    My Life In A Nutshell 10 months ago

    The story of the Ulams spiral is written in my book of maths of high school, so I get interested,
    I knew I would find a video of Numberphile, and you guys told exactly the same story, but even better ! props for that my dudes

  • Gershom Maes
    Gershom Maes 10 months ago

    At times it almost feels like the *definition* of primes would be "the sequence of numbers which partially appears most frequently throughout the set of all integer functions, without ever precisely matching the results of any function".

  • RobatRobot
    RobatRobot 10 months ago

    What happens if you start drawing the square at 0? I note from other comments that since the pattern is formed in part due to the relationship between primes and odd numbers, I just wondered if it made any difference whether or not you start with an odd or even number. It would change the numerical-position of each corner, and hence the 45° nature of the existing pattern. What happens if you start at -1?

  • Kevin Morais
    Kevin Morais 11 months ago

    Factor all numbers and spot primes in between here

  • Jakob Jones
    Jakob Jones 11 months ago

    Whats more is that those stripes intersect in a regular array. They are equally spaced apart. You can notice the squares and they are all about the same size. I wonder if one can look at this in higher dimensions and find a pattern?

  • TheMattyBoy00
    TheMattyBoy00 11 months ago +1

    After seeing this I was curious about other spirally shapes, so I wrote a quick java program to generate a 1001x1001 grid of a rhombus shape like this:
    ... 6 2 8
    13 5 1 3 9
    12 4 10
    ...and the result is rather astounding! You can see clear horizontal lines of prime numbers (but not many vertical), some of which seem to carry on for very long without much interference. Link to picture in first reply (I think some people block comments with links in them so it's best to have it separate)

  • explosu
    explosu 11 months ago

    I also notice some that are very sparse. If there's anything in between, it makes me wonder if there are some lines with finite primes, or completely solid

  • BeN Dr0wNeD
    BeN Dr0wNeD 11 months ago

    I wonder... If someone were to take all thos dots and indent them onto paper as braille what words could a blind person make from it??

  • anoderone
    anoderone 11 months ago

    So... lines with only odd numbers have more primes than lines with only even numbers: well done Sherlock!
    I tried doing the same but with only odd numbers and using a hexagonal spiral instead of square. I also get an interesting line. In the first (6n²+8n+3) there are 5 primes in the first 6 elements (3, 17, 43, 81, 131, 193), but then only 3 primes in the following 9 elements. So... meh. I think the conclusion from such a spiral done further would just be that lines with no multiples of 3 (such as 6n²+18n+13) have more primes than lines made of multipes of 3...

  • Parthian Capitalist
    Parthian Capitalist 11 months ago

    So if I don't listen to lectures and just doodle, I'll become famous,

  • bruno alves
    bruno alves 11 months ago

    I always thought that random is an absolute thing, something either is random or it is not. Apparently prime numbers are not random, but they dont seem to form any concrete patterns either, so how can they be random and at the same time not?
    I believe that there is a formula somewhere or a way that we have not even considered or thought about to find all prime numbers.
    I just don't think that they are random if they form some kind of patterns, and as numberphile showed there are a lot of patterns. If they were random they would look like that image that he showed.
    So, if they are not random, they can be predicted, that's my belief.

  • Ostrum
    Ostrum 11 months ago

    at 7:04 anyone else recognise this looking a bit like part of the Mandelbrot set?

  • YipHyGaming - Truncation [150 coming]

    Died at the sack one tho

  • GordieGii
    GordieGii 11 months ago

    Part of it is because half of the diagonals are even.

  • Federico
    Federico 11 months ago

    it really looks like FF. and in fact other ppl already did it :D

  • verioffkin
    verioffkin 11 months ago

    We can do the same with letters or even words.

  • Sudden Cucumber
    Sudden Cucumber 11 months ago

    Sacks spiral looks like a fingerprint

  • Libor Supcik
    Libor Supcik 11 months ago

    2 What ifs...a] what if you use 3D spiral in some regular way which may be a way wool threads are made; b] what if you print it out binarily adding the 0s and 1s into a 2D or 3D spiral smudging [bold font] out the ones that belong to primes 1 to 15 = [1101110010111011110001001101010111100110111101111]

  • OriginalLictre
    OriginalLictre 11 months ago

    Considering that regular hexagons tesselate just as well as squares, I wonder what the prime distribution would look like in a hexagonally arrayed Ulam spiral.

  • Pola Huchwajda
    Pola Huchwajda 11 months ago +1

    Isnt 1 prime?

  • nerdzilla135
    nerdzilla135 11 months ago

    wow Vi got a mention

  • Jay Steg
    Jay Steg 11 months ago

    You need to move 2 around to each 8 places around one and generate all of those images. Then place the 2 in each point in 3 dimensions around 1 and generate those spirals. Then you may have more basis for a pattern. A useful one. You could also consider starting with zero. It's just dang interesting need more variants.

  • Hans Lee
    Hans Lee 11 months ago +1

    The thumbnail looks like James is tripping on acid

  • Weldy Wiel
    Weldy Wiel 11 months ago

    Ask him.. whats the forecasting formula for a lottery winning number..

  • Meena Patil
    Meena Patil 11 months ago

    He used squares to make a spiral lines..can we use higher powers..? Does it make a pattern..? Like cubes and 4th powers

  • Neeme Vaino
    Neeme Vaino Year ago

    5:10 The proof is available. Where to open it?

  • percy de vries
    percy de vries Year ago

    my theory about the diagonals showing is that because of even numbers never being able to become prime (2 excluded) there can never be prime next to eachother on a horizontal line or a verticl line for that matter which is why we seem to see diagonal lines its because its the only lines that can have primes "touching" eachother thus lines form