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.

A284275 Number of primes between n and 2^n exclusive.

Original entry on oeis.org

0, 1, 2, 4, 8, 15, 27, 50, 93, 168, 304, 559, 1022, 1894, 3506, 6536, 12244, 22993, 43382, 82017, 155603, 295939, 564154, 1077862, 2063680, 3957800, 7603544, 14630834, 28192740, 54400018, 105097554, 203280210, 393615795, 762939100, 1480206268, 2874398504
Offset: 1

Views

Author

Vincenzo Librandi, Mar 26 2017

Keywords

Examples

			a(3) = 2 because there are 2 primes between 3 and 2^3: 5, 7 (we don't count the boundary of the interval in this case).
a(4) = 4 because there are 4 primes between 4 and 2^4: 5, 7, 11, 13.
		

Crossrefs

Programs

  • Magma
    [0] cat [#PrimesInInterval(n+1, 2^n): n in [2..28]];
    
  • Mathematica
    Join[{0}, Table[PrimePi[2^n] - PrimePi[n],{n, 2, 36}]] (* Improved by Alonso del Arte, Mar 26 2017 *)
  • PARI
    a(n) = if (n==1, 0, primepi(2^n) - primepi(n)); \\ Michel Marcus, Mar 26 2017
    
  • Python
    from sympy import primepi
    def a(n): return primepi(2**n - 1) - primepi(n) # Indranil Ghosh, Mar 26 2017

Formula

a(n) = A007053(n) - A000720(n), for n > 1. - Michel Marcus, Mar 26 2017