The OEIS mourns the passing of Jim Simons and is grateful to the Simons Foundation for its support of research in many branches of science, including the OEIS.
login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
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(n-1) + primepi(n^2+n) + primepi(n^2-n) - 2*primepi(n^2).
a(n) = Sum_{i=1..n} (primepi(i^2+i) + primepi(i^2-i) - 2*primepi(i^2)).
a(n) = 2 + Sum_{i=2..n} (A089610(i) - A094189(i)), for n >= 2.
a(A192391(m)) = a(A192391(m)-1), for m >= 2.
EXAMPLE
a(1) = primepi(1^2+1) + primepi(1^2-1) - 2*primepi(1^2) = 1+0-2*0 = 1.
a(2) = a(1) + primepi(2^2+2) + primepi(2^2-2) - 2*primepi(2^2) = 1+3+1-2*2 = 1.
a(3) = a(2) + primepi(3^2+3) + primepi(3^2-3) - 2*primepi(3^2) = 1+5+3-2*4 = 1.
a(4) = a(3) + primepi(4^2+4) + primepi(4^2-4) - 2*primepi(4^2) = 1+8+5-2*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(s-n+1, s); L.append(a); a0 = a
print(*L, sep = ", ")
(PARI) a(n) = sum(i=1, n, primepi(i^2+i) + primepi(i^2-i) - 2*primepi(i^2)); \\ Michel Marcus, May 24 2023
CROSSREFS
Sequence in context: A305980 A329601 A230578 * A089132 A107259 A121041
KEYWORD
sign
AUTHOR
Ya-Ping Lu, Apr 29 2023
STATUS
approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified May 23 16:36 EDT 2024. Contains 372765 sequences. (Running on oeis4.)