login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 


A189025
Number of primes in the range (n - 2*sqrt(n), n].
7
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, 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, 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
OFFSET
1,3
COMMENTS
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.
MATHEMATICA
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}]
Table[PrimePi[n]-PrimePi[n-2Sqrt[n]], {n, 130}] (* Harvey P. Dale, Feb 28 2023 *)
PROG
(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
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
T. D. Noe, Apr 15 2011
STATUS
approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | 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 September 21 16:51 EDT 2024. Contains 376087 sequences. (Running on oeis4.)