login
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