login
A370796
Number of primes between (prime(n)+1)^2 and (prime(n+1)-1)^2.
1
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, 42, 0, 51, 301, 48, 114, 0, 233, 0, 122, 126, 59, 135, 133, 0, 283, 0, 66, 0, 386, 396, 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
OFFSET
1,1
COMMENTS
If (prime(n),prime(n+1)) is a twin prime pair, then a(n)=0.
FORMULA
a(n) = A038107(A000040(n+1)-1) - A038107(A000040(n)+1) for all n > 1;
a(n) = A038107(A000040(n)+1) - A038107(A000040(n+1)-1) for n=1.
EXAMPLE
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.
MAPLE
A370796:= proc (n)
local count, a, b, p:
count := 0:
a := (ithprime(n)+1)^2:
b := (ithprime(n+1)-1)^2:
p := n:
while ithprime(p) <= b do if a <= ithprime(p) then count := count+1 end if:
p := p+1 end do:
return count end proc:
A370796(1) := 2:
map(A370796, [$1 .. 100]);
MATHEMATICA
Table[Abs[ PrimePi[(Prime[n+1]-1)^2]- PrimePi[(Prime[n]+1)^2]], {n, 72}] (* James C. McMahon, Mar 02 2024 *)
PROG
(Python)
from sympy import primepi, prime, nextprime
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
CROSSREFS
Cf. A050216.
Sequence in context: A161800 A246608 A100344 * A094596 A143024 A271971
KEYWORD
nonn
AUTHOR
Rafik Khalfi, Mar 02 2024
STATUS
approved