cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A058249 (Smallest prime >= 2^n) - (largest prime <= 2^n).

Original entry on oeis.org

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

Views

Author

Labos Elemer, Dec 05 2000

Keywords

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

Examples

			n = 1: a(1) = 2 - 2 = 0,
n = 9: a(9) = 521 - 509 = 12.
		

Crossrefs

Programs

  • 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}]]
  • PARI
    a(n)=nextprime(2^n)-precprime(2^n) \\ Charles R Greathouse IV, Sep 20 2016

Formula

a(n) = A014210(n) - A014234(n) = A013603(n) + A013597(n).

Extensions

Edited by M. F. Hasler, Feb 14 2017