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”).

A230774
Number of primes less than first prime above square root of n.
2
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, 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, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5
OFFSET
1,5
COMMENTS
Or repeat k (prime(k)^2 - prime(k-1)^2) times, with prime(0) set to 0 for k = 1.
This sequence is useful to compute A055399 for prime numbers.
LINKS
Jean-Christophe Hervé, Table of n, a(n) for n = 1..10000
FORMULA
Repeat 1 prime(1)^2 = 4 times; for k>1, repeat k (prime(k)^2-prime(k-1)^2) = A050216(k-1) times.
a(n) - A056811(n) = characteristic function of squares of primes.
EXAMPLE
a(5) = a(6) = a(7) = a(8) = a(9) = 2 because prime(1) = 2 < sqrt(5 to 9) <= prime(2) = 3.
MATHEMATICA
Table[1 + PrimePi[Sqrt[n-1]], {n, 100}] (* Alonso del Arte, Nov 01 2013 *)
PROG
(Python)
from math import isqrt
from sympy import primepi
def A230774(n): return primepi(isqrt(n-1))+1 # Chai Wah Wu, Nov 04 2024
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
STATUS
approved