# Greetings from The On-Line Encyclopedia of Integer Sequences! http://oeis.org/ Search: id:a362663 Showing 1-1 of 1 %I A362663 #25 Jun 16 2023 13:44:55 %S A362663 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, %T A362663 7,9,10,10,10,13,14,13,16,15,14,14,17,17,15,17,17,16,16,18,18,20,22, %U A362663 18,19,19,18,19,17,19,25,27,27,30,31,37,35,35,34,34 %N 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]. %C A362663 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. %H A362663 Ya-Ping Lu, A plot of a(n) for n up to 100000 %F A362663 a(n) = a(n-1) + primepi(n^2+n) + primepi(n^2-n) - 2*primepi(n^2). %F A362663 a(n) = Sum_{i=1..n} (primepi(i^2+i) + primepi(i^2-i) - 2*primepi(i^2)). %F A362663 a(n) = 2 + Sum_{i=2..n} (A089610(i) - A094189(i)), for n >= 2. %F A362663 a(A192391(m)) = a(A192391(m)-1), for m >= 2. %e A362663 a(1) = primepi(1^2+1) + primepi(1^2-1) - 2*primepi(1^2) = 1+0-2*0 = 1. %e A362663 a(2) = a(1) + primepi(2^2+2) + primepi(2^2-2) - 2*primepi(2^2) = 1+3+1-2*2 = 1. %e A362663 a(3) = a(2) + primepi(3^2+3) + primepi(3^2-3) - 2*primepi(3^2) = 1+5+3-2*4 = 1. %e A362663 a(4) = a(3) + primepi(4^2+4) + primepi(4^2-4) - 2*primepi(4^2) = 1+8+5-2*6 = 2. %o A362663 (Python) %o A362663 from sympy import primerange; a0 = 0; L = [] %o A362663 def ct(m1, m2): return len(list(primerange(m1, m2))) %o A362663 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 %o A362663 print(*L, sep = ", ") %o A362663 (PARI) a(n) = sum(i=1, n, primepi(i^2+i) + primepi(i^2-i) - 2*primepi(i^2)); \\ _Michel Marcus_, May 24 2023 %Y A362663 Cf. A014085, A089610, A094189, A192391. %K A362663 sign %O A362663 1,4 %A A362663 _Ya-Ping Lu_, Apr 29 2023 # Content is available under The OEIS End-User License Agreement: http://oeis.org/LICENSE