# Dissecting the complexity of prime numbers

Each prime number greater than $9$, written in base $10$, ends with one of the four digits $1,3,7,9$. Therefore, each ten can be classified according to which of these four digits, summed to the ten, yields to a prime number.

For example, for the first ten we have $1 \rightarrow \{1,3,7,9\}$. In fact, $10+1$, $10+3$, $10+7$ and $10+9$ are all primes. Conversely, for the twentieth ten the association reads $20 \rightarrow \{\}$, since there are no primes between $200$ and $209$.

It is easy to see that each ten is associated to one (and only one) group of symbols, chosen among the following $16$ distinct alternatives: $\{\}$, $\{1\}$, $\{3\}$, $\{7\}$, $\{9\}$, $\{1,3\}$, $\{1,7\}$, $\{1,9\}$, $\{3,7\}$, $\{3,9\}$, $\{7,9\}$, $\{1,3,7\}$, $\{1,3,9\}$, $\{1,7,9\}$, $\{3,7,9\}$, $\{1,3,7,9\}$.

For the sake of simplicity, we can identify each of these $16$ distinct groups of symbols with a single symbol, or with a single color, as illustrated below:

Each of these colors represents how many prime numbers there are in one ten (and which ones). In practice, we have just split the complexity of primes into tens and colors.

This allows us to rearrange the colors within the Pascal's triangle, by means of the associated ten, obtaining the following scheme (the numbers in the squares represent the tens):

The complexity of the primes sequence has been now split into rows, diagonals and colors.

An advantage of such representation is that it mixes groups of primes related to far tens, allowing maybe to identify patterns and/or to dig out connections among already known integer sequences. The clear disadvantage is that the patterns on this triangle depend on which base we use.

I partially introduced this representation of prime numbers here, but I am not sure whether these further developments overlap with some very well known technique (e.g. Sieve of Eratosthenes?).

In conclusion, just not to re-invent the wheel, my question is:

Do you know if such representation has been already devised? In that case, could you please give me some reference?

Sorry for naivety and incorrectness, and thank you very much for your suggestions and comments!

NOTE: The conjecture contained in the following EDIT is FALSE, and there is a mistake in the code! Please, if you have a good software to produce the picture, please tell me! Thanks! (Thanks also to Paul!)

I produced the following plot (omitting the first ten)

I hope that there is not some mistake in my code! However,

It is conjectural that, for very big numbers, there cannot be colored squares other than on the outer edge of the triangle,

which means that, beyond a certain integer $N$, the primes will all fall in tens (powers of ten) that can be written in the form $t=\binom{n}{k}$, where $k$ is $2,3,4$ maximum. This may lead to interesting consequences, considering that this property should not change much according to the base, and primes are infinite.

As mentioned in the NOTE, this picture is actually incorrect. It should look like this:

Still working on it!

• The most interesting thing is, it looks symmetric! – tarit goswami Aug 27 '18 at 12:58
• @taritgoswami Well, this is a property of Pascal's triangle. – user559615 Aug 27 '18 at 13:00
• When there are no primes in a block of $10$, like between $200$ and $209$, you should denote this $20 \to \{\}$, not $20 \to \{0\}$. The notation you use suggests that $200$ is prime. The former notation, $20 \to \{\}$ correctly suggests that the set of primes is the empty set, i.e., there are no primes. – 6005 Aug 27 '18 at 19:52
• @AndreaPrunotto: This is uncannily complete in many languages: rosettacode.org/wiki/Ulam_spiral_(for_primes) So instead of highlighting primes, highlight the ten's with your gradations. – Alex R. Aug 28 '18 at 18:30
• @AndreaPrunotto I tried to reproduce the image and I don't have the big white area. I think your code doesn't handle big numbers (numbers above $2^{31}-1$, the maximum value of a signed 32-bit integer) well. Which programming language are you using? You must use some big number library, which may be already available in the language you're using, or otherwise you can probably find it online somewhere. – Paul Aug 28 '18 at 21:19