# Is there more than one occurrence of a power of two between twin primes?

$2^2$ is between the twin primes $3$ and $5$. Are there any other instances of a power of two between twin primes? If so, how many?

That there are Mersenne primes (primes of the form $2^n-1$) makes this a little more tantalizing, but a brief search didn't spit out any results right away.

-

No: if $n$ is odd, $3\mid 2^n+1$, and if $n$ is even, $3\mid 2^n-1$.

To see this, note that $2^n+1=2^n+1^n$, which is divisible by $2+1$ if $n$ is odd, while $2^{2k}-1=4^k-1^k$ is divisible by $4-1$.

-
Nice. Thank you! – Jed Feb 21 at 21:47
@Jedediyah: You’re welcome! – Brian M. Scott Feb 21 at 21:50
Alternatively, $2^n-1,2^n,2^n+1$ are three consecutive integers. One of them has to be divisible by $3$, and it can't be $2^n$. – f'' Feb 21 at 23:57
@f'': True enough; sometimes the first workable idea that occurs to one isn’t the simplest idea! – Brian M. Scott Feb 21 at 23:59
Ah yes @f''! I recognize that now. I think I have seen this problem before but worded differently and did not make the connection until now :) – Jed Feb 22 at 3:23

More complicatedly:

• If $2^n-1$ is a (Mersenne) prime, then $n$ must be prime: if $p|n$, then $2^p-1|2^n-1$.
• If $2^n+1$ is a (Fermat) prime, then $n$ must be a power of $2$: if $n=pk$ with $p$ odd, then $2^k+1|2^n+1$.

The only $n$ which is both prime and a power of $2$ is $2$ itself. So the only twin primes surrounding a power of $2$ will surround $2^2=4$.

-
Ohhhh I like it. – Jed Feb 22 at 3:38

Just some basics. Twin primes use the last digits of 1 & 3, 7 & 9, and 9 & 1 5 is and exception to the general rule. The powers of 2 use the last digits of 2, 4, 6, and 8. The only valid powers of 2 will have the last digits of 2 and 8. 2^2 = 4 and 2^3 = 8. Lots of luck trying to find more of them.

-