OFFSET
1,1
COMMENTS
If (prime(n),prime(n+1)) is a twin prime pair, then a(n)=0.
FORMULA
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
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
KEYWORD
nonn
AUTHOR
Rafik Khalfi, Mar 02 2024
STATUS
approved