Why are there palindromic subsequences at random among this sequence?

832 Views Asked by At

So I was thinking about the Goldbach conjecture and I rephrased it to myself as the following:

Prove that every number N is either prime or else lies halfway between two primes A and B, where A < N and N < B < 2N.

This is equivalent, because if it were true, then the following would apply:

  1. For any even number X where X/2 is prime, you know X is expressible by the sum of two primes: X/2 + X/2. (e.g. for 10, 10/2 is 5 and 5+5=10)

  2. For any even number X where X/2 is NOT prime, you know X is expressible by the sum of two primes: A + B, where A and B are whichever two primes X/2 lies between. (e.g. for 12, 12/2 is 6 and 6 is halfway between 5 and 7, and 5+7=12)

And thus the Goldbach Conjecture would be proven true, because all even numbers are proven to be expressible as the sum of two primes.


So then I went and generated the first 400 values for N of the sequence where N is "the shortest distance from X to the nearest prime number both above and below it" where X is the natural numbers 1, 2, 3, etc. If X is prime, N is 0.

Example:

2 yields 0 because it is prime.
3 yields 0 because it is prime.
4 yields 1 because it is 1 away from both 3 and 5.
5 yields 0 because it is prime.
6 yields 1 because it is 1 away from both 5 and 7.
....
10 yields 3 because it is 3 away from 7 and 13.
11 yields 0 because it is prime.
12 yields 1 because it is 1 away from 11 and 13.

So, the sequence starts off: 001 010 323 010 323 010. Already tantalizing, like everything with primes.

But then, that segues into this:

23 010 32 9056349 010 9436509 23 010 32

A palindrome! (They're all single digit numbers, grouped to help make the palindromic nature more visually evident.)

Further in you'll see:

10 9 0 1 0 15 4 3 18 7 0 9 8 3 12 5 0 15 2 15 0 5 12 3 8 9 0 7 18 3 4 15 0 1 0 9 10

Another palindrome. (This time with all numbers separate since some are two digits long. Also bolded the center of the palindrome.)

These are just the ones I've spotted, I think there are others. And there are many others I've seen that are one value away from being palindromic.

Is there any explanation for this? I'm trying to find a pattern here.