Live data from Hacker News

An Interesting Pattern in the Prime Numbers: Parallax Compression

novaspivack.com

161–170 of 195 posts

Re: An Interesting Pattern in the Prime Numbers: Parallax Compression

#161

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…

Check the observable doc now https://beta.observablehq.com/@montyxcantsin/unwinding-the-u... should be more in line with original intention.

Thanks for an interactive version. Using this, you can check the examples that Anders pointed out in his comment here: https://news.ycombinator.com/item?id=17104624 -- for example, with n=20, see that row 17, column 8 does indeed have a red dot instead of black, which does not match the claimed pattern. (Edit: I wrote more in this comment: https://news.ycombinator.com/item?id=17106193)

Re: An Interesting Pattern in the Prime Numbers: Parallax Compression

#162
post #161

Earlier quoted context omitted.

Check the observable doc now https://beta.observablehq.com/@montyxcantsin/unwinding-the-u... should be more in line with original intention.

Thanks for an interactive version. Using this, you can check the examples that Anders pointed out in his comment here: https://news.ycombinator.com/item?id=17104624 -- for example, with n=20, see that row 17, column 8 does indeed have a red dot instead of black, which does not match the claimed pattern. (Edit: I wrote more in this comment: https://news.ycombinator.com/item?id=17106193 )

Yes, the thing is the claimed pattern IS the one with the dot etc. the mistake we made was seeing how close the GCD triangle version fit and thinking it was the same when in fact it was not. The only claim I am making is that this is an interesting way to transform the ulam spiral into something less chaotic.

Re: An Interesting Pattern in the Prime Numbers: Parallax Compression

#163

This made me curious, so I wrote a javascript version that renders a larger image of it: http://www.gibney.de/parallax_primes

I made a version of your program in SmallBASIC: https://raw.githubusercontent.com/smallbasic/smallbasic.gith... I found with packSize less than about 20 the shapes vary, then increasing values of packSize results in two alternating sets of shapes.

Re: An Interesting Pattern in the Prime Numbers: Parallax Compression

#164

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…

Thanks for your comments; it helped me understand exactly what was being claimed, and what the observed pattern is.

For the benefit of others who may be similarly mystified, here's an elaboration. First, in vague terms, there are two things going on here:

1. If you colour a triangular grid according to the gcd of the coordinates, then you get a pretty picture (this is itself interesting IMO), and

2. If you colour a triangular grid according to a particular function involving prime numbers, then the picture will often (NOT ALWAYS!), and in many places (NOT EVERYWHERE!) resemble the pretty picture of (1) above.

Less vaguely, here are precise definitions:

--------------------

Draw a triangle (triangular grid) where row R (for R = 1, 2, 3, ...) has R cells or "columns" (C = 1, 2, 3, ..., R). Suppose we colour the cell at co-ordinates (R, C) to be

- black, if gcd(R, C) = 1 (that is, R and C have no common factors except of course 1), and

- red, if gcd(R, C) > 1 (that is, there is some number > 1 that divides both R and C).

(This is the sequence http://oeis.org/A054521.) Then, the triangle has a pretty and regular pattern, as shown in the post. This is not too hard to prove, but is IMO itself interesting, and a nice discovery for someone playing with numbers and visualizations. So congratulations to the authors for coming up with this.

Call this Drawing 1.

--------------------

Next, fix an even integer N, and for each pair of coordinates (R, C) with 1 ≤ C ≤ R, let S(R, C) be a particular set of N integers, to be defined precisely shortly. (Roughly, in row R, we take RN numbers and assign them to the C cells in a round-robin fashion.)

For example, for N = 10, the first 3 rows have 6 cells so 60 numbers, so in row 4, the numbers 61 to 100 are distributed as follows:

    S(4, 1) = {61, 65, 69, 73, 77, 81, 85, 89, 93, 97}

    S(4, 2) = {62, 66, 70, 74, 78, 82, 86, 90, 94, 98}

    S(4, 3) = {63, 67, 71, 75, 79, 83, 87, 91, 95, 99}

    S(4, 4) = {64, 68, 72, 76, 80, 84, 88, 92, 96, 100}
In general, to define the elements of the set S(R, C), start with (R(R-1)N/2 + C), and increase by R each time, until there are N integers. In Python notation,

    S[(R, C)] = range(R*(R-1)*N/2 + C, R*(R+1)*N/2 + C, R)
Then, colour the cell with coordinates (R, C) with:

- black, if any of the numbers in the set S(R, C) are prime, and - red, if none of the numbers in the set S(R, C) is prime.

Call this Drawing 2 (for a particular value of N).

--------------------

Now, note the following:

- when cell (R, C) in Drawing 1 is red, i.e. when gcd(R, C) > 1, then in Drawing 2, whatever the value of N, all the numbers in the set S(R, C) are divisible by that gcd, so none of them can be prime.

- when cell (R, C) in Drawing 1 is black, i.e. when gcd(R, C) = 1, then in Drawing 2, especially for larger values of N, you have a set of N integers that have no particularly forced reason to be composite, so it's rather likely that at least one of them may be a prime. (This can be made somewhat more precise using standard number-theory heuristics like the Cramer random model, but nothing that reaches the level of proof.)

So Drawing 2, which depends on the primes, is likely to resemble Drawing 1 (red in all the places where Drawing 1 has red), but with occasional additional red dots (where Drawing 1 has black) that break the nice, regular pattern. Some of these counterexamples are listed in this comment: https://news.ycombinator.com/item?id=17104624

(I haven't worked out the details but I think we can prove things like that there will be infinitely many of these counterexamples if we extend the triangle far enough, but also that the ratio (asymptotic density) of these counterexamples will be small. So "the pattern will kind of hold" is about all we can say.)

--------------------

What does all this tell us about primes? Unfortunately, not much it appears. To the extent that there is a nice pattern in the picture, it comes from the regular properties of the gcd function. And if one considers the deviations from the regular pattern as what's interesting, then it tells us things only in a diffuse way: whereas with Ulam's spiral one sees individual primes, here what one sees visually is cases where in a particular set of N numbers none of them happened to be prime.

Still, the pictures are pretty to look at, and that counts for something. :-)

Re: An Interesting Pattern in the Prime Numbers: Parallax Compression

#166
post #98

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 unfo…

I think I figured out what the authors were claiming/drawing, and an actual definition: https://news.ycombinator.com/item?id=17106193

Re: An Interesting Pattern in the Prime Numbers: Parallax Compression

#167
post #96

Earlier quoted context omitted.

For fixed n, a block (x,y) contains the numbers n/2 y^2-n/2 y + 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?

Having whitespace after the asterisk or indenting the line by two or more spaces seem to be the only possibilities according to the "Formatting Options"[1]

[1]https://news.ycombinator.com/formatdoc

Re: An Interesting Pattern in the Prime Numbers: Parallax Compression

#168
For those that like to mess around with the J programming language, here is what I believe is correct code to generate this parallax compression pattern.

  pack =: 3 : '+./ (r,y+1) $ (npc*y+1) {. (npc*y) }. p' "0
  pc =: 3 : 0
    r =: npc =: y
    c =: +/ 1+i.y
    p =: 1 p: (1+i.c*npc)
    pack i.r
  )
Image of output for numbers-per-cell = 75 here: https://twitter.com/seanstickle/status/997675789264015361

Re: An Interesting Pattern in the Prime Numbers: Parallax Compression

#169
The Javascript code at Observable has been updated to render it correctly for both even and odd values of n now.

This addresses the issues that were pointed out below for the most part.

In short, actually there are some curious patterns in this, and they are not simply equivalent to OEIS A054521 (as we, and others, initially thought they were).

For even values of n, they can be rendered by the GCD sequence, without the primality testing. But for odd values the pattern is different and GCD doesn't describe it.

The Mathematica code on Github lets you experiment with this.

There are some nice versions, and experiments in different ways of coloring or arranging the graph in the Telegram group as well.

Telegram group https://t.me/joinchat/G8AnchIna2q8yn1lGHirkA

Javascript code https://beta.observablehq.com/@montyxcantsin/unwinding-the-u...

Mathematica code: https://github.com/shaunxcode/a-pattern-in-the-primes

Re: An Interesting Pattern in the Prime Numbers: Parallax Compression

#170

The Javascript code at Observable has been updated to render it correctly for both even and odd values of n now. This addresses the issues that were pointed out below for the most part. In short, actually there are some curious patterns in this, and they are not simply equivalent to OEIS A054521 (as we, and others, initially thought they were). For even values of n, they can be rendered by the GCD sequence, without t…

Also there are versions in Perl and other languages in the Telegram group.
Post reply on HN