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!)
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 (list; graph; refs; listen; history; text; internal format)
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.
LINKS
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
Sequence in context: A031268 A237817 A306949 * A236347 A045430 A067693
KEYWORD
nonn,easy
AUTHOR
T. D. Noe, Apr 15 2011
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 April 25 10:22 EDT 2024. Contains 371967 sequences. (Running on oeis4.)