A092131 Distance from 2^n to the next prime.
0, 1, 3, 1, 5, 3, 3, 1, 9, 7, 5, 3, 17, 27, 3, 1, 29, 3, 21, 7, 17, 15, 9, 43, 35, 15, 29, 3, 11, 3, 11, 15, 17, 25, 53, 31, 9, 7, 23, 15, 27, 15, 29, 7, 59, 15, 5, 21, 69, 55, 21, 21, 5, 159, 3, 81, 9, 69, 131, 33, 15, 135, 29, 13, 131, 9, 3, 33, 29, 25, 11, 15, 29, 37, 33, 15, 11, 7, 23
Offset: 1
Examples
a(13)=17 because 2^13=8192 and the next prime is 8209=8192+17.
Links
- T. D. Noe, Table of n, a(n) for n=1..5000
Crossrefs
Programs
-
Mathematica
Join[{0},NextPrime[#]-#&/@(2^Range[2,80])] (* Harvey P. Dale, Jun 06 2012 *)
-
PARI
for(i=1,100,x=2^i;print1(nextprime(x)-x,","))
Formula
a(n) = nextprime(2^n) - 2^n.
Comments