Thanks to comments from readers we have found that the pattern does not exactly match the GCD triangle for some values of the number of cells and rows.
This possibly makes it a more interesting finding. But it also means we can’t use GCD to render it quickly for all values.
In the code on Observable we were using GCD as a shortcut to render it because it saved time compared the earlier approach. However readers correctly pointed out that the rendering was not always correct using GCD.
Now that we know GCD doesn’t apply to all values of n, we are reverting to the original code, which generates the correct renderings for all values - but is slower - and there will be an update on Observable soon.
Meanwhile - to see the original code at work, and test it out for any value yourself, here is the Mathematica notebook code:
Https://GitHub.com/shaunxcode/a-pattern-in-the-primes
The Observable JavaScript code is being updated soon to account for this.
Join the discussion in the Telegram group as well - details below.
T = (n, k) => { return (GCD(n, k) == 1) ? 1 : 0; }
The given code doesn’t use primes, primesSet, or isPrime at all.
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
…
Https://GitHub.com/shaunxcode/a-pattern-in-the-primes
He's not claiming it holds for _all_ n, just for _many_ n.
[1095, 1108, 1121, 1134, 1147, 1160, 1173, 1186, 1199, 1212, 1225, 1238, 1251, 1264]
none of which are prime. cellToTerms(13, 14, binomialCoEfficient2, 3) in the observable gives the same list (though no such calls are made when generating the picture).
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
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.