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 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.

  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 which X/2 lies between.

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.


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.

  • 1
    $\begingroup$ I'm pretty sure your phrasing isn't equivalent. Is 3 halfway between two primes? (1 is not prime.) $\endgroup$ – hexaflexagonal Jun 24 '15 at 20:00
  • 1
    $\begingroup$ It seems that there is a pattern and I found this interesting. However when you take a random sequence of numbers won't you find some palindrom somewhere of some length ? I mean, the first palindrom is long but I would blame it on the necessary low values of gaps and the second is not that long... $\endgroup$ – Clément Guérin Jun 24 '15 at 20:45
  • 1
    $\begingroup$ I have already tried to find something like a pattern appearing in problems involving prime numbers. I ended by realizing that it was nothing but my imagination. I do not say that it is the case in the present situation. $\endgroup$ – Clément Guérin Jun 24 '15 at 20:51
  • 3
    $\begingroup$ @Aerovistae I think there is (in part) an artifact. A palindrome in the sequence of gaps between primes will automatically yield a palindrome in your sequence. For instance, if you consider the following sequence (where $0$ denotes a prime number and $x$ denotes a composed number): $0xxx0x0xxx0xxxxx0x0xxxxx0xxx0x0xxx0$, then you automatically obtain the sequence $0x2301032905634901094365092301032x0$ as a result. In other words, this latter palindrom simply reflects a much smaller palindrom in the following sequence of prime gaps: $4,2,4,6,2,6,4,2,4$. How often these occur is another question. $\endgroup$ – yoann May 8 '18 at 13:32
  • 2
    $\begingroup$ A palindrome in the positions of primes makes a long palindrome in this sequence of numbers more likely, but not guaranteed. For example: 0-----0-2301032-0-----0 (zeroes are primes; and I included the values of your function for the longest palindromic substring). $\endgroup$ – David Schneider-Joseph May 8 '18 at 13:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.