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