login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

Number of primes less than first prime above square root of n.
2

%I #21 Nov 04 2024 17:30:03

%S 1,1,1,1,2,2,2,2,2,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,4,4,4,4,4,4,4,4,4,

%T 4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,

%U 5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5

%N Number of primes less than first prime above square root of n.

%C Or repeat k (prime(k)^2 - prime(k-1)^2) times, with prime(0) set to 0 for k = 1.

%C This sequence is useful to compute A055399 for prime numbers.

%H Jean-Christophe Hervé, <a href="/A230774/b230774.txt">Table of n, a(n) for n = 1..10000</a>

%F Repeat 1 prime(1)^2 = 4 times; for k>1, repeat k (prime(k)^2-prime(k-1)^2) = A050216(k-1) times.

%F a(n) - A056811(n) = characteristic function of squares of primes.

%e a(5) = a(6) = a(7) = a(8) = a(9) = 2 because prime(1) = 2 < sqrt(5 to 9) <= prime(2) = 3.

%t Table[1 + PrimePi[Sqrt[n-1]], {n, 100}] (* _Alonso del Arte_, Nov 01 2013 *)

%o (Python)

%o from math import isqrt

%o from sympy import primepi

%o def A230774(n): return primepi(isqrt(n-1))+1 # _Chai Wah Wu_, Nov 04 2024

%Y Cf. A050216, A056811, A055399, A230775.

%K nonn,easy

%O 1,5

%A _Jean-Christophe Hervé_, Nov 01 2013