cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A189025 Number of primes in the range (n - 2*sqrt(n), n].

This page as a plain text file.
%I A189025 #15 Feb 28 2023 10:28:48
%S A189025 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 A189025 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 A189025 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 A189025 Number of primes in the range (n - 2*sqrt(n), n].
%C A189025 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 A189025 T. D. Noe, <a href="/A189025/b189025.txt">Table of n, a(n) for n = 1..10000</a>
%H A189025 Wikipedia, <a href="http://en.wikipedia.org/wiki/Legendre_conjecture">Legendre's conjecture</a>
%t A189025 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 A189025 Table[PrimePi[n]-PrimePi[n-2Sqrt[n]],{n,130}] (* _Harvey P. Dale_, Feb 28 2023 *)
%o A189025 (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 A189025 Cf. A188817, A189024, A189026.
%K A189025 nonn,easy
%O A189025 1,3
%A A189025 _T. D. Noe_, Apr 15 2011