login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

A058249
(Smallest prime >= 2^n) - (largest prime <= 2^n).
10
0, 2, 4, 4, 6, 6, 4, 6, 12, 10, 14, 6, 18, 30, 22, 16, 30, 8, 22, 10, 26, 18, 24, 46, 74, 20, 68, 60, 14, 38, 12, 20, 26, 66, 84, 36, 34, 52, 30, 102, 48, 26, 86, 24, 114, 36, 120, 80, 150, 82, 150, 68, 116, 192, 58, 86, 22, 96, 186, 126, 16, 192, 54, 72, 180, 14, 22, 56
OFFSET
1,2
COMMENTS
This sequence gives the gap between consecutive primes on either side of 2^n. The average gap between primes near 2^n should be about g=n*log(2). Cramer's conjecture would allow gaps to be as large as about g^2. - T. D. Noe, Jul 17 2007
LINKS
Robert G. Wilson v, Table of n, a(n) for n = 1..10087 (first 5000 terms from T. D. Noe).
FORMULA
a(n) = A014210(n) - A014234(n) = A013603(n) + A013597(n).
EXAMPLE
n = 1: a(1) = 2 - 2 = 0,
n = 9: a(9) = 521 - 509 = 12.
MAPLE
a := n -> if n > 1 then nextprime(2^n)-prevprime(2^n) else 0 fi; [seq( a(i), i=1..256)]; # Maple's next/prevprime functions use strict inequalities and therefore would not yield the correct difference for n=1. Alternatively, a(n) = nextprime(2^n-1)-prevprime(2^n+1);
MATHEMATICA
Prepend[NextPrime[#]-NextPrime[#, -1]&/@(2^Range[2, 70]), 0] (* Harvey P. Dale, Jan 25 2011 *)
Join[{0}, Table[NextPrime[2^n] - NextPrime[2^n, -1], {n, 2, 70}]]
PROG
(PARI) a(n)=nextprime(2^n)-precprime(2^n) \\ Charles R Greathouse IV, Sep 20 2016
CROSSREFS
KEYWORD
nonn
AUTHOR
Labos Elemer, Dec 05 2000
EXTENSIONS
Edited by M. F. Hasler, Feb 14 2017
STATUS
approved