Hamming distance between consecutive primes

69 Views Asked by At

The Hamming distance between strings of equal length is the number of mismatches between the strings

MYSTERY
MASTERS
 ^    ^

This distance can be defined for binary numbers as

1000111001
0010111011
^ ^     ^

The binary length of a number $n$ is $\lfloor^2\log n\rfloor+1$ and therefore $\operatorname{ham}(m,n)\leq \lfloor^2\log \max(m,n)\rfloor +1$. For an odd prime $p$ the least significant digit is $1$ and $\operatorname{ham}(p,p')\leq \lfloor^2\log p'\rfloor$, where $p'$ is the successor prime of $p$. A necessary condition then for $\operatorname{ham}(p,p')=\lfloor^2\log p'\rfloor$ is that $p\lessapprox 2^k$ and $p'\gtrapprox 2^k$ for some $k$.

3 011     61 0111101     4093 0111111111101
5 101     67 1000011     4099 1000000000011

For the first $100,000,000$ primes there are only four values $p'\in\{3,5,67,4099\}$ for which $\operatorname{ham}(p,p')=\lfloor^2\log p'\rfloor$.

Are reasons to believe that there are only a finite number of prime successors with that property? Is there a value of $p'>4099$ with the property?


I just realized that $\operatorname{ham}(p,p')=\lfloor^2\log p'\rfloor$ is equivalent with that $p+p'=2^r$ for some $r$.

1

There are 1 best solutions below

0
On BEST ANSWER

Not a full answer:
Well, What you are looking for are consecutive primes of the form: $$p=2q+1,p'=2(2^n-q-1)+1$$ where $0<q<2^{n}$
(that's because $2^n-1-q$ is simply a bit inversion)
Now, let's take both equations modulo 3: $$p\equiv 2q+1\implies q\equiv0,2$$ $$p' \equiv 2(2^n-1-q)+1\implies 0,1 \equiv2^n-q$$ if $q\equiv 0$, $2^n-q$ can't divide 3 and thus $2^n\equiv1$ and thus $n$ is even.
if $q\equiv 2$, $0,1\equiv2^n-2\implies0,2\equiv2^{n-1}-1\implies 0,1\equiv 2^{n-1}$ and thus $n$ is odd.
Or, stated differently, if $n$ is even than $q\equiv 0 \pmod 3$ and if $n$ is odd than $q\equiv 2 \pmod 3$.
One other property of such a pair is that $p'+p=2^{n+1}$ which have some study to them:
I found this https://www.primepuzzles.net/puzzles/puzz_223.htm