8 ms·
I was thinking in the same direction but could not come up with a simple test. Your idea to start with "is not divisible by 2 .. 3 .. 4 .." is great. It's inte
by no_gravity 8y ago
I was thinking in the same direction but could not come up with a simple test. Your idea to start with "is not divisible by 2 .. 3 .. 4 .." is great.
It's interesting, that up to 4, it's a perfect pattern:
function isPrime(n) { return n%2 && n%3 && n%4; }
As soon as you get to 'Not divisible by 5' noise starts to appear:
function isPrime(n) { return n%2 && n%3 && n%4 && n%5; }
This 'noise' closes some gaps between the pattern and makes it look like runes.
Would any type of noise do this?
Here is how it looks like with some random noise added:
function isPrime(n) { return n%2 && n%3 && n%4 && (Math.random()>0.95); }
It is not as structured as the version based on primes.
As of now, I'm not sure what to make of it. Maybe there is some other type of simple 'noise' that creates something as complex and logical as the primes. Maybe not.