
Prime number patterns - dmarinoc
http://www.jasondavies.com/primos/
======
aaronharnly
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.

[1] <https://en.wikipedia.org/wiki/Ulam_spiral>

[2] <http://www.numberspiral.com>

[3] <http://www.dcs.gla.ac.uk/~jhw/spirals/index.html>

~~~
Confusion

      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.

~~~
monochromatic
There are TONS of patterns in the primes.

~~~
Confusion
Name me a pattern that, from the primes below 100, can be used to extrapolate,
with certainty, the first prime above 100.

~~~
monochromatic
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.

------
mutagen
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.

------
kevindication
Two things that were non-obvious to me but made me extremely happy when they
worked: panning and zooming.

~~~
mikegirouard
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.

~~~
jasondavies
Thanks, it should handle resizing better now.

~~~
olalonde
Slightly off-topic but how did you find out your site was submitted on HN?

------
alokm
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.

------
ColinWright
Interesting - exact same submission - exact same URL - submitted 12 days ago:

<http://news.ycombinator.com/item?id=4202198>

1 upvote, no discussion.

~~~
toomuchcoffee
But the title was much less descriptive.

~~~
ColinWright
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._

~~~
nessus42
Indeed the title did not stand. The title was recently changed, just as you
asserted it "should" be.

------
toomuchcoffee
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.

~~~
dxbydt
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.

~~~
toomuchcoffee
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.

------
jasondavies
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).

~~~
jjaredsimpson
Adding the fact that: perfect(x) -> abundant(nx) | n>=2

gives a proof why.

------
supo
I didn't know that the Sieve of eratosthenes could look this good!

------
cturner
It's interesting that the curve on the left passes through zero rather than
one.

I've always been inclined to think 1 _x = x, and think of one as fundamental.
But the pattern shows that rather than 1_ x 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?.

~~~
brianpan
1\. By definition

2\. Because the math works out better

If 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.

<http://en.wikipedia.org/wiki/Prime_number#Primality_of_one>

~~~
cturner
"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?

~~~
jerf
"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.

------
forinti
I think he meant "El Padrón de los Números Primos". Patrón means "boss", not
"pattern".

~~~
yeahboats
It also means pattern. The source page also uses patrón.
<http://www.polprimos.com/>

~~~
jasondavies
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. :)

~~~
eevilspock
What you created is pretty boss.

------
Bullislander05
This is extremely neat! The visual semi-patterns here are very interesting.

------
craig552uk
3^n sequence looks like fractal penguins

------
guard-of-terra
It would look 2x nicer if they removed 0 ~ prime number branches and waves
beginning from primes. Much easier to spot, less clutter.

~~~
recursive
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.

~~~
guard-of-terra
They should have removed 0 ~ number sections.

------
pehrlich
wow, that is very nice. Does anyone else think they notice that primes are
near to highly divisible numbers?

~~~
zipdog
I recall a successful 'highest prime' search using a system that checked
numbers of the form 2^n - 1 (or something like that)

~~~
acoster
Those are called Mersenne Primes, and are in the form 2^p - 1, where p is a
prime number.

------
crisnoble
I had always liked the number 42. However, I must say n=48 looks a lot nicer.

~~~
toomuchcoffee
Try touching down some place strongly composite, like 720.

------
wildtype
Lets see how the explanation help me to solve ProjectEuler's problems.

------
minikrob
Simply stunning, many thanks for the link !

------
Zenst
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.

~~~
recursive
You can drag the number line to the left. I'm past 1000 and haven't found the
highest prime yet.

~~~
Zenst
Thank you, yip click - hold down mouse and move it left. Thats my afternoon
bumped now lol

------
mayneack
This doesn't work in IE 8

------
JoeCortopassi
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

~~~
macspoofing
What are you talking about?

~~~
anonymoushn
He's talking about the inability of Hacker News submissions to retain their
title when it differs from the title of the article. This is particularly
bothersome when the title of the article is something vague like "Prime number
patterns" or "On concepts and realities."

It is against the rules to talk about this problem, though. From the
guidelines: "Please don't post on HN to ask or tell us something (e.g. to ask
us questions about Y Combinator, or to ask or complain about moderation). If
you want to say something to us, please send it to info@ycombinator.com."

~~~
toomuchcoffee
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?

~~~
anonymoushn
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...](https://www.google.com/search?q=site:news.ycombinator.com+stop+changing+post+titles)

------
thlt
it can be eye catchy but says really nothing interesting about prime numbers
nor their patterns

~~~
nessus42
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.

~~~
thlt
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.

~~~
nessus42
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.

~~~
dxbydt
>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.gif>

2\. hippocampal neurons & primes -
<http://www.hindawi.com/journals/amp/2011/519178/fig8/>

~~~
yaks_hairbrush
> 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.

~~~
nessus42
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.

~~~
yaks_hairbrush
You're welcome!

> 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.

Yep. Sure blew my mind when I saw a proof of quadratic reciprocity (a very
neat result about square numbers in modular arithmetic) which used complex
analysis (how on earth can complex numbers prove stuff about modular
arithmetic!?)

> Maybe everything I said above is wrong in some way...

Not really. Your intuition upon seeing this visualization was pretty much
right on: studying periodic functions is a way of understanding numbers.

> Or maybe what I've said is so obvious to someone who has studied math
> seriously that they just want to shout, "Duh!"

Not so much. It took some mighty smart folks to develop some ideas which are
perhaps suggested, in hindsight, by this picture. The big one is Fourier
series and transforms, which allow you to decompose periodic functions into
their constituent sine waves. You can use Fourier analysis to get information
about number theory, which was essentially your suggestion. However, that's
not at all obvious without seeing this picture. Certainly, my first exposures
to Fourier analysis were in the context of signal processing and solving PDEs.
I had absolutely no inkling that it may be useful for number theory until
actually seeing it. Even if I had seen this picture 7 years ago (when I knew
signal processing and PDEs, but not number-theoretic applications), I probably
would not have made the connection that you made.

So, I think your intuition was a rather non-obvious idea, and so your comment
did not deserve the quick shoot-down. (And even if it were obvious to folks
who have studied math, it would still be non-obvious to someone, probably).

~~~
nessus42
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!

~~~
yaks_hairbrush
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 identity

1 + 1/4 + 1/9 + 1/16 + ... = pi^2/6

And, 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.

