login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A104103 a(n) = ceiling(sqrt(prime(n))). 7

%I #30 Jul 28 2022 15:19:48

%S 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,

%T 12,12,12,12,13,13,13,13,13,14,14,14,14,14,15,15,15,15,16,16,16,16,16,

%U 16,17,17,17,17,17,17,17,18,18,18,18,18,19,19,19,19,19,19

%N a(n) = ceiling(sqrt(prime(n))).

%C Number of squares (including 0) less than prime(n).

%H Charles R Greathouse IV, <a href="/A104103/b104103.txt">Table of n, a(n) for n = 1..10000</a>

%F 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

%e a(5)=4 because prime(5)=11 and there are 4 squares <= 11, namely 0, 1, 4 and 9.

%t Ceiling[Sqrt[Prime[Range[80]]]] (* _Harvey P. Dale_, May 09 2020 *)

%o (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

%o (PARI) apply(n->sqrtint(n)+1,primes(100)) \\ _Charles R Greathouse IV_, Aug 23 2012

%o (Python)

%o from math import isqrt

%o from sympy import prime

%o def A104103(n): return 1+isqrt(prime(n)) # _Chai Wah Wu_, Jul 28 2022

%K nonn

%O 1,1

%A _Giovanni Teofilatto_, Mar 04 2005

%E Edited by _Zak Seidov_, Sep 24 2007

%E Several terms >= 9 corrected, following an observation by Kevin Ryde, by _M. F. Hasler_, Aug 23 2012

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified September 1 06:23 EDT 2024. Contains 375575 sequences. (Running on oeis4.)