Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
Prime Explorer (primes.io)
96 points by MrBra on April 1, 2015 | hide | past | favorite | 19 comments


I spent countless hours on this with a pencil and calculator in the 90's, laboriously back-fitting equations via recursion. This is the fulfilment of a dream!

Also: 4x² + 570x + 20233 is 100% smooth (in the given range).


I'm a complete novice when it comes to maths, but I have read that primes don't have any predictable order. Many better minds than me have proved this true I'm guessing, but visualizations like this seem to show at least a semblance of one. Or am I mistaken? Maybe that's what makes primes so intriguing.


A lot of the pattern comes down to primes being relatively prime to smaller numbers, which means, for example, they're 1 modulo 2, 1 or 2 modulo 3, etc. You combine these together and find that, for example, they're all (aside from 2 or 3) going to be 1 or 5 modulo 6. Which would mean that if you lined all the numbers up in rows of 6, all primes (aside from 2 or 3) would be in the first or fifth columns.

So properties can give them a "shape", but they won't identify them.


I wrote a very simple tool to visualize primes in the manor you describe; shifting columns.

[link redacted]


Nice! Great little tool :) Could you explain a bit better the coloring legend? Thanks!


Sure! You can type any number up to 10,000,000,000 and it will show up to 10,000 consecutive numbers.

Color key:

Prime or 1 = Purple

Divisible by 2 = pink

Divisible by 3 = green

Divisible by 5 = blue

Divisible by 7 = yellow

Composite number = gray

Clicking any color will other than prime will turn any numbers with that factor gray.


Thanks. Is the choice of using different colors only up to 7 an arbitrary choice or is the result of some particular property/theory?


Good question. The first of the odd primes up to 7 occur as the most frequent factors, other than 2. So 3,5,7 are most often reoccurring. Because of the patterns they illustrate especially when modulating the columns it seemed to make sense.

While all of that is true, the original concept for the project was based off the Sieve of Eratosthenes.

http://simple.wikipedia.org/wiki/Eratosthenes#Other_discover...


Hehe I asked because time ago I implemented something similar (using console though) and by instinct I was doing the same, coloring numbers based on divisors to see patterns, and primes, but just when I wanted to get some conclusion out that, I had to stop and do something else, so it kinda remained in my brain as something I had to finish to consciously understand.

Thanks for explaining then, so what we did is a Sieve of Eratosthenes... But I have to admit that I also coded it to see which particular patterns (if any) primes were drawing on screen.. :)


That's pretty sweet!


If we were considering weather for example we could say that the weather is predictable over a period of 1 second, somewhat predictable over a period of 1 hour, and unpredictable over a period of 1 year. It doesn't matter how much historical weather data you collect you just can't say anything about the weather over long periods of time.

If a math writer says "the primes are unpredictable" this means something like if you were given a list of all the primes between 1 and some number N then there is no way to find the next prime after N that is faster than testing the primality of N+1,N+2,... until the next one is found.

The speed of the primality test doesn't matter for predictability. It doesn't matter if I can check the current weather in 1 second or 1 millionth of a second, it doesn't help me know the weather a year from now.

But not being able to work out the next prime quickly isn't the whole story. There are many things that we can say about the whole set of primes. We do know that the next prime after N won't be much bigger than N in some sense (see Bertrand's postulate). We also know roughly how many primes there are less than a given number (Prime number theorem).

There are also many properties that exist in small sets of primes (twin prime conjecture) and the OP's visualization shows some of these. So, much like the weather, the primes are not random while still being unpredictable.


Primes ARE fundamentally predictable, in the following very strong sense: There is a deterministic polynomial time algorithm for checking whether a number is prime (i.e. the runtime is polynomial in the number of digits of the number being tested.) http://en.wikipedia.org/wiki/AKS_primality_test



What are those coefficients and how are they calculated?


this app is using a lot of computing power, as evidence by my laptop fan whirring.


Well, that's for a good cause.


This is awesome! thanks!


This got me 100% prime

-622x² + 1868x + 2011


For the range they display, that is true.

If X = 2011, then you end up with

-2511684703, which is a factor of 2011 and (-1247104+1868+1).




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: