Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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

share|cite|improve this question
up vote 21 down vote accepted

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

share|cite|improve this answer
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$.

share|cite|improve this answer
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.

share|cite|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.