[go: up one dir, main page]

login
A104103
a(n) = ceiling(sqrt(prime(n))).
7
2, 2, 3, 3, 4, 4, 5, 5, 5, 6, 6, 7, 7, 7, 7, 8, 8, 8, 9, 9, 9, 9, 10, 10, 10, 11, 11, 11, 11, 11, 12, 12, 12, 12, 13, 13, 13, 13, 13, 14, 14, 14, 14, 14, 15, 15, 15, 15, 16, 16, 16, 16, 16, 16, 17, 17, 17, 17, 17, 17, 17, 18, 18, 18, 18, 18, 19, 19, 19, 19, 19, 19
OFFSET
1,1
COMMENTS
Number of squares (including 0) less than prime(n).
LINKS
Charles R Greathouse IV, Table of n, a(n) for n = 1..10000
FORMULA
a(n) = A000196(A000040(n)) + 1. (Although ceiling(sqrt(n)) = A000196(n-1) + 1 in general, the -1 is not needed here since no prime is a square.) - M. F. Hasler, Aug 23 2012
EXAMPLE
a(5)=4 because prime(5)=11 and there are 4 squares <= 11, namely 0, 1, 4 and 9.
MATHEMATICA
Ceiling[Sqrt[Prime[Range[80]]]] (* Harvey P. Dale, May 09 2020 *)
PROG
(PARI) A104103(n)=sqrtint(prime(n))+1 /* More than twice as fast as the "trivial" implementation using ceil(sqrt(p)), and avoids errors due to insufficient realprecision (although this is unlikely to be an issue, since prime(n) is limited to precomputed primes < primelimit). */ \\ Charles R Greathouse IV and M. F. Hasler, Aug 23 2012
(PARI) apply(n->sqrtint(n)+1, primes(100)) \\ Charles R Greathouse IV, Aug 23 2012
(Python)
from math import isqrt
from sympy import prime
def A104103(n): return 1+isqrt(prime(n)) # Chai Wah Wu, Jul 28 2022
CROSSREFS
Sequence in context: A320297 A165906 A165907 * A194964 A029923 A375114
KEYWORD
nonn
AUTHOR
Giovanni Teofilatto, Mar 04 2005
EXTENSIONS
Edited by Zak Seidov, Sep 24 2007
Several terms >= 9 corrected, following an observation by Kevin Ryde, by M. F. Hasler, Aug 23 2012
STATUS
approved