Hacker News new | comments | show | ask | jobs | submit login
An Interesting Pattern in the Prime Numbers: Parallax Compression (novaspivack.com)
326 points by airesearcher 4 hours ago | hide | past | web | favorite | 98 comments





The drawing is incorrect.

More specifically, it’s a drawing of OEIS A054521 (black if gcd(row, col) == 1, red otherwise), not of the parallax compressed primes. The two drawings do not match as claimed. The first place where they differ is row 9, column 1, which is drawn as black even though none of 217, 226, 235, 244, 253, 262 are prime.

It’s clear that gcd(row, col) == 1 is a necessary condition for there to be any primes in that cell (which consists of the numbers col + 3row² − 3row, col + 3row² − 2row, col + 3row² − row, col + 3row², col + 3row² + row, col + 3row² + 2row), but it’s not sufficient. There’s no way it could be sufficient, because there are only constantly many (six) numbers tested in every cell, but the asymptotic density of the primes goes to 0 and the asymptotic density of A054521 goes to 6/π².


Their picture is correct, but only because they are doing something more ridiculous than this. Every one of the squares in their picture represents 75 numbers, not 5 numbers.

Click on the definition of T, and you see exactly the A054521 formula.

T = (n, k) => { return (GCD(n, k) == 1) ? 1 : 0; }

The given code doesn’t use primes, primesSet, or isPrime at all.


But that does produce a picture identical to theirs. Because they are using 75 numbers per square, they do end up hitting at least one prime in each box with (n,k)=1 for the first 75 rows. This pattern won't continue much longer, which is why they've conveniently stopped the picture at that point.

From what we have seen in our tests, the pattern holds for the number of rows n, where n = the number of integers contained in a cell. After n rows the symmetry breaks. We haven't tested every possible n yet however. It would be great to do more tests and let's see if there are exceptions.

Can you explain how that picture would be produced with 75 numbers per square? The generalization that seems obvious to me already fails in both cells of row 2, because 75 is odd:

row 1, col 1: [1, 2, 3, …, 75], has primes

row 2, col 1: [76, 78, 80, …, 224], no primes

row 2, col 2: [77, 79, 81, …, 225], has primes


You are completely right; their pattern holds iff (I believe, not proven!) the number they take 75 for is even. If you take any even number of rows (== amount of numbers per cell, in their construction), say 6, or 74, or 76, the pattern works.

No, it still fails for even n; see my other comment: https://news.ycombinator.com/item?id=17104624

Fair point, I missed that. Scratch my claim.

Then their claim that this pattern holds isn't even true; as pointed out elsewhere, and is obvious when you write out the sequence items explicitly in terms of their coordinates, any gcd!=1 cell will be red. But a gcd=1 cell need not be black, for many n.


The claim is that using N numbers per square will result in the pattern holding for N rows, for arbitrarily large N.

Even if I’m misunderstanding how this is supposed to work for odd n, this claim fails for plenty of even n.

n = 14: fails on row 13, col 3

n = 20: fails on row 17, col 8

n = 30: fails on row 17, col 7

n = 38: fails on row 37, col 8

n = 44: fails on row 31, col 2

n = 50: fails on row 43, col 13


I think you may misunderstand what terms are in a cell. For instance in your first example what numbers live there? In that observable you can run cellToTerms(row,n,binomialCoEfficient2,col) to get the terms. You can then chain .map(isPrime) (for reasonable sizes it is slurping in data to make testing faster). Those fns are there for interactivity I have not gotten around to adding yet.

From OP: > Interestingly, this same pattern holds for more numbers, and for different intervals.

He's not claiming it holds for _all_ n, just for _many_ n.


Those are some pretty basic checks to miss. Perhaps I've misread OP's claim.

I think OP is a bit confused, the post is very ambiguous and on telegram he added more info but still hasn't fully formalized what he's trying to say

This made me curious, so I wrote a javascript version that renders a larger image of it:

http://www.gibney.de/parallax_primes


Using your frames here's the sequence as N goes from 2 to 90 with a stride of 2: https://streamable.com/l7r96

So does the pattern work or not? People are saying it's not plotting primes, but there is clearly a prime check in this code

The original pattern uses prime check (as per this code). OP claimed an exact match with http://oeis.org/A054521 - but this isn't true for many N (see vietjtnguyen's streamable). Perhaps it approaches it as N grows large?

Awesome! It's the math enthusiast's dream to come up with something new and exciting outside of academia. Recently I discovered what I thought was an interesting chaotic map, but after posting a question about it to Math StackExchange[1] and emailing one or two professors (no response, which is understandable), my obsession waned and I gave up on trying to figure out if it had any significance. Maybe I should keep trying!

[1] https://math.stackexchange.com/questions/2654984/identifying...


Keep going!

Don't forget: There's nothing bad about no-response - People are much more likely to respond on the web and email when you're wrong. ;)


Yep - we are not claiming to be mathematicians, we're pattern hunters... this is an open invitation to others with more expertise to chime in and help figure this out... it's possible it is a minor discovery or even not a discovery... or it could be useful or even very useful. We don't know. Please help us explore it!

Either way, hearing a mathematician explain why this is a non-discovery would still be interesting to pretty much anyone who doesn't study primes. Kudos on a cool visualization.

Disclaimer: I am not a mathematician.

Assuming: You didn't make a mistake anywhere and the math checks out.

The problem, and the interesting picture is that 3 is a prime number and you have a triangle of 75 elements (so 3-75 over-weights all other relations visually).

If I'm getting what you are trying to do, then extent it to 5 and it may give you "fractality" in 3D space.

In any case, the fact that you are observing it, most likely comes from fact that you chose to draw a triangle and made 75 important in a set where 3 intrinsically chops the creating of new prime numbers (and is important to 75).


If nothing else, this depiction of prime numbers looks very satisfying for recreational mathematics, much more so than the Ulam spiral. I think students who learn how to generate this pattern will be inspired to learn more about math.

My take, but correct me if I'm wrong.

Take the relation to the GCD triangle http://oeis.org/A054521

At GCD(n,k)!=1 all numbers are divisible by GCD(n,k) therefore contains no prime

At GCD(n,k)==1 we have https://en.wikipedia.org/wiki/Dirichlet%27s_theorem_on_arith... - so those series contain infinitely many primes - and seems like they actually contain at least one prime in all the pixels of the first N rows (but this should be explained/proved, if it is always true for any chosen N, or just happen to be true for the N-s tried by the OP)


You're onto it: what you say would still need to be proven is actually not even true, see anderskaseorg's comments, e.g. https://news.ycombinator.com/item?id=17104624.

So their picture is nice, and the gcd!=1 cells are all red, but the gcd=1 cells need not be black. For odd N this fails loads of times (always?), and for even N you quickly find failing cells when you start looking for it (see linked comment).


I wonder why the authors took the time to generate an image of their pattern but refrained from giving the actual DEFINITION. This does not foster constructive discussion of any possible ideas present. As can be seen in dozens of well-meaning comments here, people waste time reversing and guestimating parameters etc.

Looking at the layman letters that my institute gets on a regular basis, I can say, that this is unfortunately a recurring theme with amateur mathematicians: They fail to state their basic definitions and assumptions and seem all to eager to dive right into applications, be it computer graphics, cryptography or finance.

More to the point: This picture seems from a cursory inspection to plot T(k,n) with n=row, k=column from the top left. But why is this interesting?


It wasn't exactly clear to me when I read the article, so here's my explanation:

- take a line of integers, color them black if prime, red otherwise

- hexagonally arrange them in a spiral (similar to Ulam's spiral)

- cut the hexagon into six equilateral triangles

- overlap the triangles (rotate where necessary)

- if any pixels are black, color the whole thing black, if none are black, color it red

- interesting pattern arises

- interesting pattern already exists as per http://oeis.org/A054521

Edit: They may be packing more than 6 numbers into a pixel, looks like 75. Unsure how that would look visually, but you extend the above to use 75 or any other number. Unsure why 75 was chosen, maybe it's the only interesting one?


Just check the numbers listed in one of the referenced articles, it is easy to expand it by induction to numbers greater than 6: https://beta.observablehq.com/@montyxcantsin/unwinding-the-u...

It also helps to understand my other comment about the explanation of the pattern and GCD equivalence...


My gut sense is that this has something to do with visualizing the sieve of Eratosthenes, and nothing more than that. But I'd be happy to hear otherwise.

Other than the sieve of Eratosthenes being a way to compute a finite list of primes I don't see the relationship here. Could you elaborate?

I think the relationship is that the sieve has a natural shape since it's based on ruling out multiples.

Isn’t the sieve’s eventual shape just the list of prime numbers?

A few quick observations:

- The right edge of the triangle is always red (ie, no primes present), because it represents (row number) * (3* (row number)+[1..6])

- Prime numbered rows are always black (except the far right column). I can sort of feel why this is true but can't express it mathematically yet.


It's equivalent to http://oeis.org/A054521

Cell i of row j contains n elements of an arithmetic progression, with common difference of j. If i and j have a GCD != 1, they are not coprime, so they share a factor p, as do all numbers in the sequence, so they cannot be prime

Otherwise it's very likely there's at least one prime

If j is prime every column i is coprime with it, so it's going to be black


What would it look like if instead of a binary coloring, you used a gradient coloring representing the number of primes in each range?

From a cryptography standpoint, could this hint at attack vectors for things like discrete log problems? I've only learned of the math behind that myself recently, not sure what implications having a "topographical map of the primes" could have, especially if the pattern is relf-repeating regardless of the size of the primes.

> on January 18, 2018, I found a numerical sequence that generated the exact same pattern as Shaun’s pattern

Does this mean that we have a sort of bloom filter-esque test for primality? (ie, it will give you a guaranteed no in O(1) but you'll have to crunch numbers to get the yes?)

If so, are there implications for things that want to know "is it prime?" quickly? Crpytography comes to mind, for instance...


>Does this mean that we have a sort of bloom filter-esque test for primality?

This catches most non-primes ;)

bool maybe_prime(x) { return x % 2 && x % 3 && x % 5 && x % 7; }


And it's infinitely expandable to improve accuracy, at a linear cost of computation!

This is both, correct, and useless.

Corpos would love it.

We already have quick algorithms that say "is it prime" with certainty. Reducing the required time from O(log^6(n)) to O(1) isn't particularly important from cryptographic point of view.

https://en.wikipedia.org/wiki/Primality_test#Fast_determinis...


Note that log(n) is the length of the prime, so if you are using 2048 bit primes, log⁶(n) is quite large. I don't think anyone actually uses one of the general deterministic primality testing algorithms in cryptographic applications.

It also doesn't reduce the time to O(1). Each of the ranges is of size O(2^(N/2)) for an N bit prime, so it's really not useful at all.


Just run a search on: prime numbers fractal, and many interesting articles (both academic and other) will surface. Search for: zeta function fractal, and you'll find more. I'm no mathematician but it wouldn't surprise me if two very deep fields turn out to be different "manifestations" of some deeper underlying truth, and I then wonder about the possibility of a larger grand unified theory that includes both maths and physics that would have far reaching insights which would go beyond both mathematics and physics, but then I realise that perhaps I've seen too many movies :-)

We will be happy with "it's a really pretty visualization of the primes" or "it's an improvement on the Ulam Spiral." But if it has more value than that (not sure.. but possibly there is some link in this that might be useful) then that's great too.

These runes would serve excellently as a written alphabet for an alien species in fiction (or maybe for modrons or other Lawful creatures in D&D).

I'd like to see the triangle fractal as a starting state for Conways "Game of Life".

As displayed in the image, every other row is offset by half a square from being on a grid.

Maybe if you shifted everything to the left to line it up, but


Is there are particular reasoning or meaning to each dot being 6 numbers? Is there any significant changes if you pick other numbers per dot, following the same pattern?

Based on the linked explanation here: https://beta.observablehq.com/@montyxcantsin/unwinding-the-u...


Because primes exist on a base 6 numeric scale. Where all prime numbers are multiples of 1 and 5.

... I think that statement is only true for the prime number 5. ;)

I was wondering this myself. I skimmed to the code but can't find any variable for this.

The claim is that it is the same pattern independent of the number of integers per dot.

If the numbers of integers-per-dot was set to 1, the sequence would simply highlight prime numbers as they progress through the pyramid shape since “Parallax Compression” would no longer apply.

Yet they say that this only seems valid for the number of rows equal to the number of integers-per-dot that was used. So, it would indeed highlight with reasonable certainty all the primes in the first row. (I am not a mathematician but I think that is "1" ?)

The triangle is a hexagon folded onto itself. That's what the "parallax" part is.

This just shows the reduced residues mod n. There are n squares in the nth row from the top. Color the kth square of the nth row black if gcd(k,n)=1, color it red otherwise.

That's what the OEIS sequence they link to says. I hadn't realized that it makes such a beautiful pattern!

You're correct. The correspondence just seems to be due to some bound on the prime gap for arithmetic progressions (or perhaps something even more trivial that I'm missing). A cursory search suggests it might be a consequence of Ingham's bound. In any case, it doesn't yield much of interest.

How is that?

Isn't it plotting a prime spiral, not GCD?

Obviously prime implies gcd=1, but the "kth" square isn't "k", because it's a spiral counting up from the center.


No, it isn't plotting a prime spiral. Each square in their triangle is a block of 75 numbers. Within the nth row the numbers are sorted by residue mod n.

I am a little confused. When it says that each square corresponds to n sequential numbers, does it mean that the first square is the first n, and the second square (which is on the second row) is the first n after those, and the third square (also in the second row) has the first n after those, and so on,

Or, do the regions overlap?

I tried to look at the first 4 rows for n=5, but did not see the pattern depicted (each interval had a prime in it).

Am I interpreting what is meant by the blocks incorrectly, or does the pattern not work for small enough n?


For fixed n, a block (x,y) contains the numbers n/2y^2-n/2y + yz + x for all 0 <= z < n.

Making sure I am parsing that correctly:

Is that

((n/2) * y^2) - ((n/2) * y) + (y * z) + x ? (For z ranging from 0 to n)

If so, alright, that makes more sense to me, thanks.

So, n * (y * (y-1)/2) + x + y * z ?

Edit: does HN have an escape character to deal with the asterisks?


(n/2)y^2-(n/2)y + yz + x

Just a heads up, but I would pay money for mugs/t-shirts with the pattern. Of course I can just use to code to make it myself, but it's nice to support people sometimes

Is each row the same as if the remainder on division of the cell number by the row number is 0 then red, otherwise black?

I would also like a clearer explanation of how this was generated, maybe with pseudocode, and would also like to see the larger images mentioned in the post.

As it is, the explanation doesn't really make sense to me.

EDIT: Found this lower down: https://beta.observablehq.com/@montyxcantsin/unwinding-the-u...


This is awesome. How can we access the code to play around with?

It is in an observable doc so you can fork it etc. https://beta.observablehq.com/@montyxcantsin/unwinding-the-u...

“Fooled by randomness.”

The Telegram link leads to a distribution channel, not a group, so one cannot actually discuss it there. I let the author know through the contact feature on the website, as it might be unintentional.

Edit: The link was changed to a group (at the bottom of the post).


fixed

Does this get us closer to being able to generate the Nth prime without factorization / primality test of every number?

This is... Amazing...!

I wonder if there's a pattern to how many primes per cells-with-primes.



I'm noticing a few neat things about there is left-right reflected symmetry.

Really neat! (I still know I haven't the math chops though. Good place to further my study)


"It looks like something they found on the ship at Roswell."

If this can really map prime numbers to a least a general region, would we be able to break Diffie-hellman key exchange more quickly?

If so this could be a huge blow to security.

But I must say this is amazing that they were able to visualize prime numbers in this way. These guys are geniuses.


No, this won't help with finding primes. As they noted, the pattern for ranges of size k only holds for k lines. So to find a prime of length N (on the order of 2^N), we need to have k=O(2^(N/2)). However, this yields a guarantee that a prime lies in a range of size O(2^(N/2)), which is not particularly useful. We get exponentially better probabilistic results from the prime number theorem.

I was initially thinking the same, but I don't think that's the case. This will help you find a small range of six potential primes (pick any element on the left edge of the triangle). But you're still required to calculate the factorizations on those six numbers to determine which of them are indeed prime.

The pattern looks nice, but I would have asked some mathematicians before announcing this as something novel.

I think the invitation is extended by sharing the blog post.

I understand what you mean, but how many great breakthroughs in history were where someone shared the foundation of an idea and then another formalized it?

I think it happens fairly often.

In the more mathematical realm in information theory, turbo codes came out of nowhere by people who were not experts in the field of FEC. Their efficiency far surpassed other methods of the time, to the point that their results in the conference paper were doubted. They didn't have any understanding at the time of why they worked well, they just published results.

Lots of physical phenomena start as simple observations that are later worked into theoretical frameworks. The photoelectric effect comes to mind.


>The pattern looks nice, but I would have asked some mathematicians before announcing this as something novel.

The blog post serves that function.


Come on, does every cool thing need a stamp of approval by "experts" before publication?

"SQLite looks nice, but I would have double checked with Oracle engineers before announcing this as something novel"


Well, to some extent, yes.

Otherwise you’d end up like the MD who’ve “rediscovered” numerical integration (the trapezoid method) and got it published in the journal of diabetes or whatever.


> Otherwise you’d end up like the MD who’ve “rediscovered” numerical integration (the trapezoid method) and got it published in the journal of diabetes or whatever.

This was shocking because calculus is a required subject in American high schools, and this American doctor presumably went to American high school, not because the doctor didn't check in with mathematicians. Frankly, it would be equally shocking if the doctor had asked a mathematician if integration were a thing, because presumably a doctor is an educated member of society.


What's the harm in that ?

So mathematicians should be reviewing papers in the Journal of Diabetes? I think that the Journal of Diabetes should just stay in its lane.

It's a blog post, not a peer-reviewed paper. And the tone certainly sounds to me like an invitation to mathematicians "Hey, we're amateurs who found this cool thing, can you tell us more about it?"



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

Search: