Prime number patterns 359 points by dmarinoc on July 17, 2012 | hide | past | web | favorite | 100 comments

 Very, very lovely. You might (or might not) also be familiar with the Ulam Spiral[1] or the arguably more beautiful Sacks Spiral[2], which do reveal certain patterns in the distribution of the primes.I used the software from this site[3] to generate a large Sacks spiral graphic, which I had custom-printed on my shower curtain. To most folks who see it, it's just some pattern of dots, but knowing the order within gives me great joy.
 Thanks for the links. Math is awesome, and this kinda stuff really gets one going. No wonder some people (mathematicians) get hooked on prime numbers for the rest of their lives. It's beautiful.
 Fantastic.Fig.5 from [2] (Sacks spiral) reminded me of light cones tipping over and pointing at the singularity as one enters a black hole.
 `````` which do reveal certain patterns `````` Perceived patterns. If an actual pattern was known, you could generate prime numbers from the pattern. No such pattern is known to exist.
 It's probabilistic, but there are patterns (lines with significantly greater prime densities than others).
 There are TONS of patterns in the primes.
 Name me a pattern that, from the primes below 100, can be used to extrapolate, with certainty, the first prime above 100.
 That's an awfully restrictive definition of "pattern." For what it's worth, I'd say that more mathematics has been devoted to the study of patterns in the primes than to any other single topic.
 I'd like to add tone generation so you could hear the various harmonics being added and removed as you worked up through the numbers, occasionally hitting a pure sine wave as you hit a prime number.
 Two things that were non-obvious to me but made me extremely happy when they worked: panning and zooming.
 Exactly, I'm not much of a numbers guy but this was really beautiful and when I hit the scroll wheel on my mouse and it got bigger I was "oh, now that's cool."
 That is a very nice touch. Good catch.It does seem to break a bit if you resize the browser after the initial render. A refresh will fix it though.
 Thanks, it should handle resizing better now.
 Slightly off-topic but how did you find out your site was submitted on HN?
 Yeah, I zoomed as far as I could out and it worked really well. Good On Ya!
 You can also click the X to the top right of the title text to remove the title and blurb.
 I use CAD enough that trying that was automatic. Very cool.
 Its beautiful. It has an interesting formation of an infinite coaxial cones. with semi vertical angles arctan(1/3), arctan(1/5), ... arctan(1/(2n-1))... (The even numbers slopes form the progression of circles on the top). Although that doesn't give the pattern of the primes, it is formed because every number has a multiple for each natural number.
 Interesting - exact same submission - exact same URL - submitted 12 days ago:http://news.ycombinator.com/item?id=42021981 upvote, no discussion.
 But the title was much less descriptive.
 Agreed, but if you use a descriptive title it's likely to get changed by the mods to something less useful, simply because that's what's on the article.Indeed, this title shouldn't be allowed to stand, it should be changed to the title on the page itself, based on moderators' recent behavior.Added in edit: Oh look - downvotes for pointing out that the current HN system of finding interesting items occasionally fails.
 Indeed the title did not stand. The title was recently changed, just as you asserted it "should" be.
 I find this app to be quite interesting, actually. Even though it's really more a visualization of compositeness rather than of primality per se.
 Yeah, it took me a while to sadly realize this visualization tells us nothing useful about primes. otoh, it does tell us a lot about composites. Hover on 29. The pattern is completely useless - you get one wave of period 29, and the other wave of period unity. However, hover on 28. Now you get 6 waves - of periods 1,2,4,7,14,28 - these being the divisors of 28. The intersection of these 6 waves produces those interesting floral patterns. But obviously, this whole experiment tells us much more about 28, a composite, than 29 the prime.
 That's just the thing. Does anyone understand the primes, really?We know a lot about number fields, multiplication and sieving... but the primes themselves (the "holes" left in the wake of the sieving process) are something of an epiphenomenon to all of this.
 I hadn't realised this before making it, but one interesting pattern is that the number in between twin primes is always abundant, if greater than 6.It's reasonably simple to prove using the fact that every twin prime pair except (3, 5) is of the form (6n − 1, 6n + 1).
 Adding the fact that: perfect(x) -> abundant(nx) | n>=2gives a proof why.
 I didn't know that the Sieve of eratosthenes could look this good!
 It's interesting that the curve on the left passes through zero rather than one.I've always been inclined to think 1x = x, and think of one as fundamental. But the pattern shows that rather than 1x being fundamental, rather there is the issue of x exists or x doesn't exist. x doesn't exist => 0. I wonder if 1*x = x is really a distraction away from a better type of thinking around existence.Also, I've always been wary of the part of the rule that says that 1 is not a prime number. Why is that?.
 Visually, non-primes can be represented as a symmetrical shapee.g. 6 can be shown as`````` xxxxxx `````` but also as`````` xxx --- xxx `````` or`````` x|x x|x x|x `````` Whereas a prime like 5 doesn't have this symmetrical layout. Since 1 does have this kind of symmetry it belongs more with the non-primes.
 1. By definition2. Because the math works out betterIf it turns out that things that depend on prime numbers work in all cases except for 1, you might as well define 1 not to be a prime number.
 "By definition" is a poor justification. I almost referenced the exact link you've given here. It gives poor justification for primality of one - resting on authority and lacking justification. The closest it comes (not very) is, "If 1 were admitted as a prime, these two presentations would be considered different factorizations of 15 into prime numbers, so the statement of that theorem would have to be modified." So what?
 "The closest it comes (not very) is, "If 1 were admitted as a prime, these two presentations would be considered different factorizations of 15 into prime numbers, so the statement of that theorem would have to be modified." So what?"Many proofs depend on the unique factorization of primes, many directly and many many more indirectly. It is a trivial mechanical modification to them to deal with the non-uniqueness of a prime factorization if you admit 1 as a prime number by explicitly taking that case and saying it doesn't affect this case. So in that sense, no, it's not important.Except... you've now taken numerous proofs and made them longer... and for what? There's no didactic advantage. There's no proof that is made easier by letting 1 be prime. What's the advantage of adding all these special cases? None.And that's the real reason. In the end, "by definition" is the only justification, and the reason we choose the definition is that it works the best. Unlike 0 to the power of 0 where there's at least a bit of argument to be had (though the overwhelming preponderance is for it to be 1), there's no reason to put 1 in the set of prime numbers. Even if you don't personally consider it a "lot" of evidence, it's still entirely one sided.
 I don't believe it is a poor justification. It is a name chosen for this particular set of numbers. In fact, every name we've put on things in mathematics is "by definition". Real numbers, pi, odd numbers, perfect numbers. Someone found that particular definition useful, and others continued to use it.In the case of prime numbers I believe you cited one of the best reasons of leaving 1 out of the set. If someone needs a name for "the number one and all prime numbers", they can define it.
 "By definition" is the only possible justification, as for any other axiom in mathematics. Your intuition that such a thing is 'poor' and that there is a 'better' (why, more natural?, ordained by a divine source?) way to do it, is wrong.
 I think he meant "El Padrón de los Números Primos". Patrón means "boss", not "pattern".
 It's correct, "patrón" means both "boss" and "pattern" depending on context, but the word "jefe" is more widely used as "boss"
 And of course, it turns out that the English "pattern" is derived from French, "patron", from the sense of "a model to be imitated".
 It also means pattern. The source page also uses patrón. http://www.polprimos.com/
 I stand corrected. Never heard it used like that, but the Royal Academy confirms it: http://lema.rae.es/drae/?val=patr%C3%B3n
 Ah, good. The title is meant to be an homage to the original source of the idea.My Spanish is somewhat rusty so I didn't know it also meant boss. :)
 What you created is pretty boss.
 This is extremely neat! The visual semi-patterns here are very interesting.
 3^n sequence looks like fractal penguins
 It would look 2x nicer if they removed 0 ~ prime number branches and waves beginning from primes. Much easier to spot, less clutter.
 If they removed the branches between 0 and primes, and then removed branches beginning from primes, I don't think there would be anything left.
 They should have removed 0 ~ number sections.
 If they removed the wave beginning from a prime number what would the 2*prime number look like?
 wow, that is very nice. Does anyone else think they notice that primes are near to highly divisible numbers?
 That does make a certain amount of intuitive sense, in rough terms. In a certain "region" of the integral number line, based on the magnitude of the contained numbers, we expect a certain total number of prime factors. It makes sense that highly composite numbers might be near by primes in order to "balance out".None of this is rigorous, but I think contains some intuition with a kernel of truth.
 I recall a successful 'highest prime' search using a system that checked numbers of the form 2^n - 1 (or something like that)
 Those are called Mersenne Primes, and are in the form 2^p - 1, where p is a prime number.
 I had always liked the number 42. However, I must say n=48 looks a lot nicer.
 Try touching down some place strongly composite, like 720.
 Lets see how the explanation help me to solve ProjectEuler's problems.
 Simply stunning, many thanks for the link !
 Cute, though does appear to be limited by browser initialwindow size.Thing about prime numbers - ask yourself this question: Does the universe operate on base 10!Endless fun aint they.
 no not funny. the universe doesn`t care for the base. prime numbers are prime numbers regardless of the base or any other representation.
 What does the base have to do with anything?
 You can drag the number line to the left. I'm past 1000 and haven't found the highest prime yet.
 Thank you, yip click - hold down mouse and move it left. Thats my afternoon bumped now lol
 This doesn't work in IE 8
 Stop it, stop it, stop it, just stop. Once an article reaches the front page, it's title is no longer editable. It causes confusion and frustration, and is obviously an issue that a lot of people dislike. I don't care about prime numbers, this article was all about the visualization to me. Every time a title gets changed like this, you are telling your user base that you don't care about what they think. I feel like I'm back in Digg, waiting for something like Reddit to pop up so I don't have to deal with the 'power' users./rant
 Can't agree more... I care about prime numbers and also about visualizations. But this title is misleading. The article is not about patterns in prime numbers, but a way of visually/geometrically representing prime numbers, which is interesting on it's own. P.S: I don't what was the original title, but the current is definitely misleading.
 Was coming into this expecting an interesting piece about the distribution of prime numbers. Either a new approach to predicting them or a proof of why they're unpredictable. But no it's a visualisation of their distribution. Interesting but entirely not what was expected.
 So not that we'll "discuss" it, but is there an article link or a blog post available that explains the perceived rationale behind this most vexatious and utterly inane misfeature?
 Not really. There is a lot of discussion in the first few results here: https://www.google.com/search?q=site:news.ycombinator.com+st...
 The title originally included something like "visualization with D3.js", which has been removed for some reason
 ...and which was why I clicked on the article in the first place. Because the title was, you know, helpful and descriptive.
 I clicked on the title "Prime Number Patterns" and am a little disappointed.I'm just not seeing any patterns other than the semicircles of increasing integer diameters.Should I stare at it longer?
 Umm... yes, you should actually.Those patterns of semicircles aren't random, of course. They correspond directly to the degree of compositeness of the chosen modulus. Compare for n = 60,61,62, for example.The higher the totient value for n, the more circles you see, basically.
 Right, so I can look at the diagram and see that 59 and 61 are prime while 60 has many divisors. I can kinda see that the density of primes decreases gradually.But I can't see a broader pattern beyond that.Now here I can see some patterns! https://en.wikipedia.org/wiki/Ulam_spiral
 The title changed, and hence the topic. So no instead of a conversation about visualisations in JS, we'll have one about prime numbers.If the OP thought the "prime number" aspect was interesting, he would have posted it as such.Instead I'm sitting here looking at the OP thinking...this is not a very interesting visualisation of prime numbers.
 `` Top-10 Prime Numbers in Patterns``
 it can be eye catchy but says really nothing interesting about prime numbers nor their patterns
 I don't know much about number theory, but I think this visualization probably provides significant intuition as to why number theory, which contains only theorems about integers, uses tons of math that is about a lot more than integers.Edit: Why would anyone down-vote this comment. Barbarians at the gates, I tell you!The only possible explanation is that the down-voters thinks that the relationship between number theory and other kinds of math is so obvious that it needs no further explication to those who are less informed. In which case, this is the pinnacle of arrogance. Or the down-voter believes that there is no such relationship between number theory and other kinds of math, in which case this is the pinnacle of ignorance.In any case, I personally found the visualization inspiring. I.e., it makes me want to learn some more.
 this chart basically includes a set of periodic curves, even though it looks nice but what does it tell you about prime numbers ? Intersected by only two curves 1 and itself ??? well, everyone knows this, no need to make a chart.
 It tells you that prime numbers and periodic curves might be related more than you might have thought at first blush. I.e., if you can mathematically describe and analyze this set of periodic curves, then you have also described and can analyze the prime numbers.As I mentioned, I don't know much about number theory, but I do know that it uses a lot of math that is counterintuitive at first blush. Perhaps this visualization gives us a clue as to why that is the case.
 >if you can mathematically describe and analyze this set of periodic curves, then you have also described and can analyze the prime numbers.Dude, no offense, you are really making stuff up. The periodicity has to to with the divisors of the composites. Every prime p has exactly 2 curves - the wave of period 1, and the wave of period p. There's nothing interesting or useful to take way from that observation. otoh, you look at a composite c - it has several divisors & each divisor d generates a curve of period d, and those curves intersect in interesting ways...though I don't see how you could mathematically analyze them to tell you anything about the primes nearby. They are mostly pretty patterns, not mathematically useful...here are 2 quite famous & useful diagrams on periodicity in primes if you are interested in that sort of thing -1. the prime number cross - http://img841.imageshack.us/img841/1329/primenumbercross.gif2. hippocampal neurons & primes - http://www.hindawi.com/journals/amp/2011/519178/fig8/
 I take it, then, that you find nothing inspirational in the videos made by Vi Hart either. To each, their own.As to the diagrams you pointed me at, they mean nothing to me, and do not inspire me. If I knew more about number theory, perhaps they would. Some things are not about information, they are about inspiration.The visualization in the OP provides inspiration that number theory is connected to other fields of math. You can see structure in the way that the periodic curves intersect and the primes are the gaps. If you could understand that structure, then maybe you could understand the gaps. Then again maybe not. That doesn't mean that the question and the visualization doesn't cause you to think and wonder.Sure, this is old hat to mathematicians, and for all I know, this approach is a complete dead end. Sometimes dead ends are interesting too.
 > Dude, no offense, you are really making stuff up.No. Parent has it essentially correct. Many new results in number theory are obtained by studying automorphic forms, which are the stable waveforms, on various spaces.Things like the Riemann zeta function arise out of spectral transforms of automorphic forms.
 Thank you. I don't know what's up with the increasing trend around here for people to imply you are an idiot over some nitpick that seems to reveal only that the nitpicker spent no effort to try understanding what you had to say, and would rather berate you for a detail rather than engaging in the gist.One of the things that can seem almost mystical at times about math to someone who has not studied math heavily, is even just simple things, like how pi and e seem to get into everything, even where you might not naively expect it.The visualization in the OP shows how to use sine waves to build a sieve of Sieve of Eratosthenes. Now that I've seen the visualization, this revelation seems so utterly obvious that it goes without saying. But somehow, I never drew this connection until seeing the visualization.And once I see how "obvious" this is, it's suddenly obvious how e and pi might get into everything, because everything that repeats with a specific frequency can be modeled as a wheel rolling along and leaving a mark on every revolution. And what is multiplication, but repeated addition? I.e., a wheel of a certain size rolling down the number line, leaving its mark once per turn. Above a certain age, we tend to stop thinking about multiplication as repeated addition, and so we don't think about how all multiplication is implicitly bringing pi into everything we are doing.Maybe everything I said above is wrong in some way, since, as I have mentioned, I haven't studied any math past calculus and college algebra, and even that was so long ago, most of it I don't remember. Or maybe what I've said is so obvious to someone who has studied math seriously that they just want to shout, "Duh!" But there must be some way to interpret what I just wrote that doesn't deserve being summarily shot down.
 Thanks again! You restore my faith that it is possible to have a reasonable conversation around here.This leads me to a question: Do mathematicians actually try to analyze primes by looking at a function that is created by combining a set of sine waves where there is one sine wave for each integer, on order to form a sieve out of the sine waves? E.g., creating a function that crosses zero only at each composite, or some such? Or is this visualization only suggestive of a broad approach?The paper cited by the visualization is clearly attempting to do what I just described, but it appears to be the work of an amateur, and I don't read Spanish, so I can't really tell if this approach is on sound footing. I tried to Google around looking for this approach referenced in something more authoritative, but couldn't find any. I did find plenty of references to trying to analyze the function that you get from subtracting x/ln(x) from the prime staircase, using Fourier transforms and the like. But I can't see a direct connection between these approaches, other than the general inspiration of trying to break the problem down into a combination of sine waves. On the other hand, I'm well aware that a lot of identities in math are not readily obvious!
 Oooh... you're getting into some serious math now.The stable waves on a circle are precisely those waves which oscillate an integer number of times as they traverse. In other words, one for each integer. Further, every function on the circle can be expressed as a sum of the sine waves. That sum is called the spectral decomposition. (This is Fourier series.)With clever choices of functions, you can get some profound results. For example, picking a saw-tooth wave and doing the spectral decomposition gives the identity1 + 1/4 + 1/9 + 1/16 + ... = pi^2/6And, by the way, the left hand side is the zeta function evaluated at 2.And about functions that are zero at each composite... You may want to check out Dirichlet characters. They are periodic functions which behave nicely under multiplication. Whenever an integer and the period have a common factor, the character will be zero at that integer.It's not going to be zero at all composites, but it's on the right track.
 [deleted]
 Are you claiming that I've gleaned no insight at all as to why Fourier transforms are used in number theory? Or are you claiming that I just didn't acquire this insight from the visualization?If you claim the latter, then just where did I get it from?
 [deleted]
 Dude, I think that you are less intellectually rigorous than you strive to appear, and rude to boot.Did you look at the paper that the visualization cites? It provides both the semicircular version and a sine-wave version. The paper does some mathematical analysis on the sine wave version, and putatively comes up with a way to transform the series of sine waves for a Sieve of Eratosthenes of a finite size into a single function that is close to zero for composites and significantly non-zero for primes.I assumed on first sight of the visualization that the semicircles were standing in for sine waves, and I was right. I assumed that semicircles were used because they are easier to draw, or because it's easier to see the Sieve of Eratosthenes in it, or that it was necessary to make this adjustment in order to perform well. Or maybe just that it was prettier. But it was clearly alluding to sine waves. Looking at the paper demonstrates that I was correct on this assumption.By the way, you do know that any periodic function can be expressed as a sum of sine waves, don't you? Even a wave form made out of repeating semicircles. What I didn't know before this is that Fourier transforms are used in number theory, and now I know, thanks to this visualization. And best of all, this visualization let me intuit that fact on my own. I can't imagine a visualization that could provide anything better than that!
 It does give you a good intuition as to why twin primes aka N, N+2 are so common.
 how so ?
 The number between them have a high number of small factors including 2 and 3.`````` 2 * 3 = 6: 5 and 7 are prime. 2 * 3 * 2 = 12: 11 and 13 are prime 2 * 3 * 3 = 18: 17 and 19 are prime 2 * 3 * 5 = 30: 11 and 13 are prime 2 * 3 * 7 = 42: 41 and 43 are prime. However, 2 * 3 * 101 = 606 but 605 is not prime. But, 2 * 3 * 5 * 5 = 150 and 149 and 151 are prime. 2 * 3 * 2 * 3 * 5 = 180 and 179 and 181 are prime.``````
 I don't see where the insight is. twin primes must be of the form (6k-1, 6k+1). So of course there will be a 2,3 at least.Smaller numbers have multiples that are more densely distributed among the integers.
 The point is twin primes (6k-1, 6k+1) are more likely for a large k when k is a composite number than a prime AND the more factors of k the higher chance for twin primes.EX: K = (6 * 2 * 3 * 5 * 7 * 11 * 13 ) gives a twin prime.
 Oh? And what insights do you have share with us about prime numbers? Do tell.
 Number theory is a big field and prime numbers are its core. There are tons of discoveries about prime numbers in the history and now people are quite focusing on Zeta function and the Riemann hypothesis, check out this chart http://upload.wikimedia.org/wikipedia/commons/3/30/Riemann_z.... Read more at http://en.wikipedia.org/wiki/Prime_number
 I meant what you know. Not what wikipedia knows.
 you are taking me wrong, what I meant was the title is misleading, that's it. I didn't intend to show off my knowledge or just to downplay others.

Applications are open for YC Summer 2019

Search: