# Palindromic Numbers - Pattern “inside” Prime Numbers?

EDIT: rewritten and reduced entire post to present things more clearly.

I'm asking how to calculate the next element(s) in the sequence, located at the end of this post.

## Introduction - definitons

Two digit palindromes $\overline{aa}$ in number base $b$ are natural numbers $x=a(b+1) ,1\le a\lt b$

Plot - Let each pixel on a $n\times n$ image be a single tile with nonnegative integer coordinates $(x,y)$, where the upper left corner is the origin tile with coordinates $(0,0)$, and the last tile has coordinates $(n-1,n-1)$ as the bottom right pixel.

On some plot $P_n(x_0,y_0)$, we have that a tile has value $1$ if $x+nx_0$ is a two digit palindrome when written in the number base $b=(y+ny_0)\ge2$, and $0$ otherwise.

For example, plots $P_{400}(x_0,x_0)$ for $(x_0,x_0)=(0,0),(0,1),(1,0),(1,1)$ can be seen here, x2

Pattern Plot - coordinates are defined same as the plot. Pattern plot $P'_n(y_0)$ has tiles valued such that the tile $(x,y)$ has value $K$, where $K$ is the number of two digit palindromes in base $y+ny_0$ that can be written as $x+kn$ for some $k\in\mathbb N_0$.

Note that the pattern plot $P'_n(y_0)$ can be acquired by summing all $P_n(k,y_0)$ plots, $k\in\mathbb N_0$.
Summing plots means that corresponding values of tiles are being summed.

Notice that plots can be represented as square matrices of size $n$ with $1$'s on the corresponding places for palindromes based on $\overline{aa}_b=(x+nx_0)_{(y+ny_0)}$ condition.

If we color $K\gt0$ valued tiles with one color and rest with another, then all pattern plots $P'_n(y_0)$ for fixed $n$ and different $y_0\gt0$ are equivalent. If we color $0$ black and $\gt0$ green:

In plots $n=61,62,63,64,65,66,67,68,69$. Notice that prime numbers $61$ and $67$ are all filled.

In general, black pixels form patterns based on the divisibility of $n$. Notice that (second image) $62=2\cdot31$ where $31$ is prime, has two separate regions with identical pattern. Also, notice that (last image) $69=3\cdot23$ where $23$ is prime, has three separate regions with identical pattern.

Few more patterns can be seen in blue-white linked here.

## Colored pattern plots & difference pattern plots

For prime pattern plots, if we color different pixels with different colors, we would need only four colors. That is, bottom left tile $(0,n-1)$ will have value $(y_0+1)n-2$, tiles $(k>0,n-1)$ and tile $(0,0)$ will have value $0$, and the rest of tiles will have either $y_0$ or $y_0+1$ values.

(Note: when summing plots to prime pattern plots for $y_0=1$, $k\le4n$ works as upper bound)

Lets color $y_0$ and $y_0+1$ tile values with red and yellow. Primes $n=101,103,107$ below: (x3) You can see prime $439$ there as an larger example, but still relatively small.

All colored prime pattern plots are in general relatively similar, some more than others. By increasing $n$ we gain more detail, but a clear picture as a whole does not seem to be forming.

You might notice that the red pixels on the upper part correspond to the yellow pixels on bottom part and vice versa, relative to the horizontal central symmetry. Turns out, not all pixels follow this rule, thus we could observe those that are exceptions - as noted by Hyperplane in the comments.

Now, color only exception pixels with white and rest black in the difference pattern plots.
Again, $101,103,107$ primes below. Notice the two "central parabolas":

• Prime $101$ has the thicker one on the left, and $103,107$ have it on the right. This positioning actually tells us whether the prime number is of form $4n+1$ or $4n-1$. In fact, larger primes seem to have more new horizontal lines which contain more parabolas than the previous ones, where every parabola is distinct and their positioning describes the prime.

Now, lets extend the $101$ pattern in $y$ axis and observe it in three different colorings. Looking at the first of four images, you can see that the pixels emerging from the parabolas loop around the edges. (parabola heads correspond to horizontal line segments in the red-yellow plots)

Examining the second picture, you can see that every pixel can be traced (in purple) back to the one single parabola that is broken up at the upper and bottom edge in the original difference pattern. Since all primes are odd, this one corresponds to $2n+1$.

(... This one is trivial as we are considering only prime plots, where as composites have different colorings which I did not examine much - even though it seems that a similar pattern can be reached by grouping tiles with different colors in certain ways in composite patterns, too. - example for $202$ x1)

In the third picture (second coloring), pixels of two parabolas were traced in red and yellow, and intersected in orange. These two, tells us whether the prime number is of form $4n+1$ or $4n-1$.

The third coloring (fourth picture) shows three distinct parabolic patterns. Depending on their positioning, it tells us the form of prime relative to $18n-m$, where $m\in\{-1,1,5,7,11,13\}$.

The $n=101$ is a very small prime. Larger primes have more horizontal parabolic patterns, which there are arbitrarily many for large enough prime numbers.

Out of these so far, I've extracted the first five.
The known parabolic pattern behaviours so far (referring to them as symmetries):

$$S_1=2n+1$$

$$S_2=4n-m\in\{-1,1\}$$

$$S_3=18n-m\in\{-1,1,5,7,11,13\}$$

$$S_4=16n-m\in\{-1,1,3,5,7,9,11,13\}$$

$$S_5=50n-m\in\{2k-3,k\in\mathbb N,k\le25,k\ne\{4,9,14,19,24\}\}$$

Thus so far we have the sequence $s_n=2,4,18,16,50,\dots$. How to find the $n^{\text{th}}$ element?

One OEIS sequence seems to follow this. But why?

Or equivalently, $\text{#}_n=1,2,6,8,20,\dots$ for which OEIS returns $15$ different sequences.

I'm not sure if it will follow any of them or how to actually check/compute these symmetries.
(other than manually sorting out difference pattern plots which is not very practical)

Also not sure how handle this as a Moire pattern which the linked answer so far suggests.

• Why would you call the upper left pixel the "center pixel?" That seems a name designed for confusion. – Thomas Andrews May 3 '17 at 20:45
• The plots for the prime numbers seem to have a sort of symmetry around the central horizontal axis: If the pixel $(x,y)$ is red, then $(x,N-y)$ is very often yellow and vice versa. Maybe it would be worth to do a difference plot, i.e. only plot pixels that don't satisfy this property. From the images I would suggest that maybe their relative occurrence (#mismatches/$N^2$) goes to $0$ as $N$ gets big. – Hyperplane May 3 '17 at 21:34
• @GerryMyerson I assume you are referring to the length of this post. Anyhow, I'm just exploring things like this in my free time as a hobby. – Vepir Jun 9 '17 at 9:42
• See, this is the beauty of math. What may come from research like this? Who knows, perhaps an unknown secret of primes or perhaps nothing at all. Nonetheless, patterns like this are very fun to dive into. I encourage you to keep going! – Graviton Jul 10 '17 at 1:39
• Mathematicians don't like base-dependant maths because it often doesn't contain an underlying truth, merely a coincidence in base $b$. But this seems to find a pattern connecting primes and ALL bases $b$, something that certainly has potential for underlying truths! – Vedvart1 Jul 10 '17 at 17:45

I would put this in the comments, but I don't have enough points.

The patterns you are seeing are Moiré patterns. From wikipedia:

In mathematics, physics, and art, a moiré pattern (/mwɑːrˈeɪ/; French: [mwaʁe]) or moiré fringes are large scale interference patterns that can be produced when an opaque ruled pattern with transparent gaps is overlaid on another similar pattern. For the moiré interference pattern to appear, the two patterns must not be completely identical in that they must be displaced, rotated, etc., or have different but similar pitch.

This is a broad topic with lots of different approaches and applications, so I encourage you to research it.

In terms of finding equations to the patterns you are seeing, Mathematica is great for this. If you don't have Mathematica, you can use Wolfram Alpha. Here is an example with a list of numbers using findsequencefunction. You can also provide a list of points (generally, wolfram alpha needs five or more points to find a sequence):

findsequencefunction[{{x1, y1}, {x2, y2}, {x3, y3}, {x4, y4}}, n]


Hope this helps!