%I #15 Feb 28 2023 10:28:48
%S 0,1,2,2,3,3,4,3,2,2,3,2,3,3,2,2,3,3,4,3,3,3,3,3,3,3,3,2,3,2,3,3,3,3,
%T 2,2,3,3,3,3,4,3,4,4,3,3,4,4,4,4,4,3,4,4,4,3,3,3,3,3,4,4,3,3,3,3,4,4,
%U 4,3,4,4,5,5,5,5,4,4,4,4,4,4,5,5,5,4,4,4,5,4,4,4,3,3,3,3,4,4,3,3,4,4,5,4,4,4,5,5,6,5,5,5,6,6,6,6,6,6,5,5,5,5,5,4,4,3,4
%N Number of primes in the range (n - 2*sqrt(n), n].
%C Note that the lower bound, n-2*sqrt(n), is excluded from the count and the upper range, n, is included. The only zero term appears to be a(1). See A189027 for special primes associated with this sequence. This sequence is related to Legendre's conjecture that there is a prime between consecutive squares.
%H T. D. Noe, <a href="/A189025/b189025.txt">Table of n, a(n) for n = 1..10000</a>
%H Wikipedia, <a href="http://en.wikipedia.org/wiki/Legendre_conjecture">Legendre's conjecture</a>
%t cnt = 0; lastLower = -3; Table[lower = Floor[n - 2*Sqrt[n]]; If[lastLower < lower && PrimeQ[lower], cnt--]; lastLower = lower; If[PrimeQ[n], cnt++]; cnt, {n, 100}]
%t Table[PrimePi[n]-PrimePi[n-2Sqrt[n]],{n,130}] (* _Harvey P. Dale_, Feb 28 2023 *)
%o (PARI) a(n)=if(n<default(primelimit),primepi(n)-primepi(n-2*sqrtint(n)),sum(k=n-2*sqrtint(n)+1,n,isprime(k))) \\ _Charles R Greathouse IV_, May 11 2011
%Y Cf. A188817, A189024, A189026.
%K nonn,easy
%O 1,3
%A _T. D. Noe_, Apr 15 2011