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.

A370796 Number of primes between (prime(n)+1)^2 and (prime(n+1)-1)^2.

This page as a plain text file.
%I A370796 #25 Mar 28 2024 00:01:10
%S A370796 2,0,0,7,0,10,0,14,32,0,38,23,0,24,51,53,0,62,30,0,71,33,76,124,44,0,
%T A370796 42,0,51,301,48,114,0,233,0,122,126,59,135,133,0,283,0,66,0,386,396,
%U A370796 77,0,86,173,0,349,177,187,198,0,199,100,0,412,636,113,0,114,668,224,463,0,119,236,359
%N A370796 Number of primes between (prime(n)+1)^2 and (prime(n+1)-1)^2.
%C A370796 If (prime(n),prime(n+1)) is a twin prime pair, then a(n)=0.
%F A370796 a(n) = A038107(A000040(n+1)-1) - A038107(A000040(n)+1) for all n > 1;
%F A370796 a(n) = A038107(A000040(n)+1) - A038107(A000040(n+1)-1) for n=1.
%e A370796 For n=1, (prime(1+1)-1)^2 = 4, (prime(1)+1)^2 = 9 and we have two primes between 4 and 9, so a(1)=2.
%p A370796 A370796:= proc (n)
%p A370796 local count, a, b, p:
%p A370796 count := 0:
%p A370796 a := (ithprime(n)+1)^2:
%p A370796 b := (ithprime(n+1)-1)^2:
%p A370796 p := n:
%p A370796 while ithprime(p) <= b do if a <= ithprime(p) then count := count+1 end if:
%p A370796 p := p+1 end do:
%p A370796 return count end proc:
%p A370796 A370796(1) := 2:
%p A370796 map(A370796, [$1 .. 100]);
%t A370796 Table[Abs[ PrimePi[(Prime[n+1]-1)^2]- PrimePi[(Prime[n]+1)^2]],{n,72}] (* _James C. McMahon_, Mar 02 2024 *)
%o A370796 (Python)
%o A370796 from sympy import primepi, prime, nextprime
%o A370796 def A370796(n): return -primepi(((p:=prime(n))+1)**2)+primepi((nextprime(p)-1)**2) if n>1 else 2 # _Chai Wah Wu_, Mar 27 2024
%Y A370796 Cf. A050216.
%K A370796 nonn
%O A370796 1,1
%A A370796 _Rafik Khalfi_, Mar 02 2024