

A362663


a(n) is the partial sum of b(n), which is defined to be the difference between the numbers of primes in (n^2, n^2 + n] and in (n^2  n, n^2].


1



1, 1, 1, 2, 2, 3, 2, 2, 2, 5, 6, 6, 6, 6, 8, 10, 8, 6, 5, 5, 5, 6, 5, 5, 4, 4, 5, 5, 4, 4, 5, 5, 7, 7, 7, 9, 10, 10, 10, 13, 14, 13, 16, 15, 14, 14, 17, 17, 15, 17, 17, 16, 16, 18, 18, 20, 22, 18, 19, 19, 18, 19, 17, 19, 25, 27, 27, 30, 31, 37, 35, 35, 34, 34
(list;
graph;
refs;
listen;
history;
text;
internal format)



OFFSET

1,4


COMMENTS

A plot of a(n) for n up to 100000 is given in Links. First negative term is a(177) = 7 and first zero term appears at n = 198.


LINKS



FORMULA

a(n) = a(n1) + primepi(n^2+n) + primepi(n^2n)  2*primepi(n^2).
a(n) = Sum_{i=1..n} (primepi(i^2+i) + primepi(i^2i)  2*primepi(i^2)).


EXAMPLE

a(1) = primepi(1^2+1) + primepi(1^21)  2*primepi(1^2) = 1+02*0 = 1.
a(2) = a(1) + primepi(2^2+2) + primepi(2^22)  2*primepi(2^2) = 1+3+12*2 = 1.
a(3) = a(2) + primepi(3^2+3) + primepi(3^23)  2*primepi(3^2) = 1+5+32*4 = 1.
a(4) = a(3) + primepi(4^2+4) + primepi(4^24)  2*primepi(4^2) = 1+8+52*6 = 2.


PROG

(Python)
from sympy import primerange; a0 = 0; L = []
def ct(m1, m2): return len(list(primerange(m1, m2)))
for n in range(1, 75): s = n*n; a = a0+ct(s, s+n+1)ct(sn+1, s); L.append(a); a0 = a
print(*L, sep = ", ")
(PARI) a(n) = sum(i=1, n, primepi(i^2+i) + primepi(i^2i)  2*primepi(i^2)); \\ Michel Marcus, May 24 2023


CROSSREFS



KEYWORD

sign


AUTHOR



STATUS

approved



