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:
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,
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. :-)
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:
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, 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. :-)