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.
%I A070046 #45 Feb 16 2025 08:32:46 %S A070046 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, %T A070046 18,18,23,23,25,25,27,26,28,28,28,28,30,30,32,32,32,32,35,38,38,38,39, %U A070046 39,39,41,42,43,42,42,42,42,42,44,49,50,49,49,54,54,56,55,55,55,57,58 %N A070046 Number of primes between prime(n) and 2*prime(n) exclusive. %H A070046 Robert Israel, <a href="/A070046/b070046.txt">Table of n, a(n) for n = 1..10000</a> %H A070046 Eric Weisstein's World of Mathematics, <a href="https://mathworld.wolfram.com/BertrandsPostulate.html">Bertrand's Postulate</a> %F A070046 a(n) = primepi(2*prime(n))-n. - _Charles R Greathouse IV_, Aug 28 2014 %F A070046 a(n) = A060715(A000040(n)). %F A070046 a(n) = A063124(n)-1. - _N. J. A. Sloane_, Oct 19 2024 %e A070046 a(1)=1 because between p=2 and 4 there is exactly one prime, 3. %e A070046 a(10)=6 since six consecutive primes (31,37,41,43,47,53) are located between p(10) = 29 and 58. %p A070046 N:= 1000: # to get a(n) for n <= pi(N) %p A070046 Primes:=select(isprime,[$1..N]): %p A070046 seq(numtheory:-pi(2*Primes[n])-n, n=1..nops(Primes)); # _Robert Israel_, Aug 28 2014 %t A070046 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 *) %o A070046 (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 %o A070046 (PARI) a(n)=primepi(2*prime(n))-n \\ _Charles R Greathouse IV_, Aug 28 2014 %o A070046 (Python) %o A070046 from sympy import prime, primepi %o A070046 def A070046(n): return primepi(prime(n)<<1)-n # _Chai Wah Wu_, Oct 22 2024 %Y A070046 Cf. A060715, A077463, A246514. %Y A070046 Related sequences: %Y A070046 Primes (p) and composites (c): A000040, A002808, A000720, A065855. %Y A070046 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. %Y A070046 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. %K A070046 easy,nonn %O A070046 1,4 %A A070046 _Enoch Haga_, May 05 2002 %E A070046 Edited by _N. J. A. Sloane_, May 15 2008 at the suggestion of _R. J. Mathar_