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.

A070046 Number of primes between prime(n) and 2*prime(n) exclusive.

Original entry on oeis.org

1, 1, 1, 2, 3, 3, 4, 4, 5, 6, 7, 9, 9, 9, 9, 11, 13, 12, 13, 14, 13, 15, 15, 16, 19, 20, 19, 19, 18, 18, 23, 23, 25, 25, 27, 26, 28, 28, 28, 28, 30, 30, 32, 32, 32, 32, 35, 38, 38, 38, 39, 39, 39, 41, 42, 43, 42, 42, 42, 42, 42, 44, 49, 50, 49, 49, 54, 54, 56, 55, 55, 55, 57, 58
Offset: 1

Views

Author

Enoch Haga, May 05 2002

Keywords

Examples

			a(1)=1 because between p=2 and 4 there is exactly one prime, 3.
a(10)=6 since six consecutive primes (31,37,41,43,47,53) are located between p(10) = 29 and 58.
		

Crossrefs

Related sequences:
Primes (p) and composites (c): A000040, A002808, A000720, A065855.
Primes between p(n) and 2*p(n): A063124, A070046; between c(n) and 2*c(n): A376761; between n and 2*n: A035250, A060715, A077463, A108954.
Composites between p(n) and 2*p(n): A246514; between c(n) and 2*c(n): A376760; between n and 2*n: A075084, A307912, A307989, A376759.

Programs

  • Maple
    N:= 1000: # to get a(n) for n <= pi(N)
    Primes:=select(isprime,[$1..N]):
    seq(numtheory:-pi(2*Primes[n])-n, n=1..nops(Primes)); # Robert Israel, Aug 28 2014
  • Mathematica
    pp[n_]:=Module[{pr=Prime[n]},PrimePi[2pr]-n]; Array[pp,80] (* Harvey P. Dale, Mar 30 2015; edited by Zak Seidov, Oct 18 2022  *)
  • PARI
    forprime(p=2, 5000, n=0; for(q=p+1, 2*p-1, if(isprime(q), n++)); print1(n, ", ")) \\ Harry J. Smith, Dec 13 2007, improved by Colin Barker, Aug 28 2014
    
  • PARI
    a(n)=primepi(2*prime(n))-n \\ Charles R Greathouse IV, Aug 28 2014
    
  • Python
    from sympy import prime, primepi
    def A070046(n): return primepi(prime(n)<<1)-n # Chai Wah Wu, Oct 22 2024

Formula

a(n) = primepi(2*prime(n))-n. - Charles R Greathouse IV, Aug 28 2014
a(n) = A060715(A000040(n)).
a(n) = A063124(n)-1. - N. J. A. Sloane, Oct 19 2024

Extensions

Edited by N. J. A. Sloane, May 15 2008 at the suggestion of R. J. Mathar