Remix.run Logo
mg 3 days ago

Here is a strange one:

You look at integers in "packs" of 100. If a pack contains a prime number, you color it black, otherwise you color it red.

The first pack contains 100 consecutive integers. The second every second integer. The third every third integer and so on.

Every pack starts where the last one stopped.

On the first row, you draw 1 pack, on the second 2, on the third 3 and so on:

https://www.gibney.org/parallax_primes

It looks like hieroglyphs from another universe.

I'm still not sure why it looks the way it looks.

If you want to compare it to a random distribution, you can change this line:

    if (isPrime(myNum)) return 1;
To this:

    if (Math.random()>0.99) return 1;
Very different. I wonder where the symmetry and all the other properties of the pattern come from when using primes.
davidnc 3 days ago | parent | next [-]

This comment does a great job of clarifying the picture: https://news.ycombinator.com/item?id=17106193.

It's effectively a visualization of gcd(x,y), and has almost nothing to do with primes. Once you realize that, it's a lot easier to reason about a lot of the patterns, although it is still a pretty interesting visualization.

sejje 3 days ago | parent [-]

That's a 7 year old comment; did you just remember it existed?

Thanks for the link!

Chinjut 3 days ago | parent | prev | next [-]

Your description here does not quite match your linked code, in that it is not that the N-th pack contains integers spaced out by N. Rather, packs on the N-th row contain integers spaced out by N. For example, the third pack does not contain "every third integer", but rather draws alternating integers just like the second pack, because it is on the second row. The second pack contains (first cell of the second row) contains {101, 103, 105, ..., 299} and the third pack (second cell of the second row) contains {102, 104, 106, ..., 300}.

With this in mind, the seeming patterns of the figure you link to are explained by https://news.ycombinator.com/item?id=17106193

Chinjut 3 days ago | parent [-]

My one quibble with the comment I linked is about asymptotics. By the Prime Number Theorem, asymptotically, the density of black squares should approach zero and the density of red squares should approach 100% (including among the left diagonal which is entirely black in the displayed window, and including losing the regular appearance of rows that are entirely black except for their last cell. These black line patterns in the displayed window are both small number phenomena caused by (1 - 1/ln(R))^100 being nearly zero for small R, which stops and then goes the other way for large R.)

photonthug 3 days ago | parent | prev | next [-]

Ok this nerd-sniped me pretty good, never seen this before and assumed it would be quickly connected to the Ulam spiral mentioned elsewhere in the the thread. That particular rabbit hole kinda bottoms out in polynomial residues and the very mysterious-sounding "Conjecture F" [0].

This parallax primes thing though led to the linked page [1] which has lots of background and other connections, including the most satisfying part, which turned out more geometric [2]

[0] https://en.wikipedia.org/wiki/Ulam_spiral#Explanation [1] https://www.novaspivack.com/science/we-have-discovered-a-new... [2] https://www.cut-the-knot.org/Curriculum/Arithmetic/PrimesFro...

segfaultgolf 3 days ago | parent | prev | next [-]

Playing with this: https://g.co/gemini/share/b1979827dbe8

Okay so if you iterate only even or odd packings the pattern actually converges, which is crazy!

mg 3 days ago | parent [-]

Yes, I noticed that too. The smaller the pack size, the more random the image. The larger, the more it converges to the final pattern.

3 days ago | parent | prev | next [-]
[deleted]
xerox13ster 3 days ago | parent | prev | next [-]

I've been messing with this and you can get a very detailed view of another highly self-similar structure by changing the packsize to 1, the cellsize to 2, and then adding packSize++; to the end of the drawRow function.

shaunxcode 2 days ago | parent | prev | next [-]

I have continued to research this - should be publishing a zine about it soon!

qmmmur a day ago | parent [-]

Where?! Interested here.

BobbyTables2 3 days ago | parent | prev | next [-]

Almost looks like Klingon!

2 days ago | parent | prev | next [-]
[deleted]
pinoy420 3 days ago | parent | prev [-]

It looks the way it does because we like to see patterns even where there are none. E.g. you see a number 696969 and this seems more significant than 482649 for whatever reason

rbongers 3 days ago | parent | next [-]

Prime numbers are a pattern; take the natural numbers - starting after 2, exclude every number that isn't 2, starting after 3, exclude every number that isn't 3, etc.

It repeats like this predictably. Even though it changes, the way in which it changes is also predictable. Their repetition and predictability make prime numbers a pattern.

Out of the fundamental pattern of prime numbers, higher-level patterns also appear, and studying these patterns is a whole branch of math. You can find all kinds of visualizations of these patterns, including ones linked in this thread.

It's not that you're seeing a pattern that's not there, it's that you're seeing a pattern that gradually becomes infinitely complex.

AnotherGoodName 3 days ago | parent | prev | next [-]

Prime numbers have extremely well understood patterns and this is what he's seeing. There's a weird and persistent myth that there's 'no patterns in prime numbers' but of course factors repeat at known intervals and prime numbers are the inverse of numbers with factors. So if you can accept that numbers with factors have a pattern to them (which should be obvious, they repeat at known intervals by definition) you should be able to accept prime numbers, the inverse of numbers with factors, have patterns too since they are just the gaps in the pattern of numbers with factors.

These patterns were documented and well understood starting in BC times by Erasthosenes and learning them as part of prime number theory is a 101 course in tertiary maths education. So it's really really weird for anyone to say "there's no patterns". There are and they are extremely well understood and known.

Here's a simple pattern; All prime numbers above 2 are odd. Well duh right? Otherwise they'd be a multiple of 2, not prime.

Well let's extend this. All prime numbers above 6 are of the form 6n + 1 or 6n +5. Otherwise they'd be a multiple of 2 or 3.

Once more; All prime numbers above 30 are of the form 30n + one of [1,7,11,13,17,19,23,29]. Anything else would be a multiple of 2,3 or 5. You can extend this forever. Note each time we do this we're reducing how many numbers could possibly be prime. From 1/2 to 2/6 to 8/30 numbers possibly being prime. Keep going with this and you'll converge to the prime counting function.

Basically whenever you have a composite number there's well understood periodic gaps in primality. People understand this more intuitively for base 10 where anything ending in 0,2,4,6,8 is a multiple of 2 and anything ending in 0,5 is a multiple of 5 hence you only get primes ending in 1,3,7,9 when writing in base 10 but this idea works for any composite number. This leads to the extremely well known and well understood patterns you get when you graph primes in various ways.

polivier 3 days ago | parent | prev [-]

Are you talking about the patterns found in the linked website of the parent comment? Because there clear patterns there.