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!)
A337769 Smallest integer m such that the sum of the first m prime numbers is greater than n^2. 2

%I #27 Apr 19 2022 00:01:38

%S 1,2,3,4,5,6,7,8,9,10,10,11,12,12,13,14,15,15,16,17,18,18,19,20,20,21,

%T 22,22,23,24,24,25,26,26,27,28,28,29,30,31,31,32,32,33,34,34,35,36,36,

%U 37,38,38,39,40,40,41,41,42,43,43,44,45,45,46,46,47,48,48

%N Smallest integer m such that the sum of the first m prime numbers is greater than n^2.

%F a(n) = Min{m}, Sum_{i=1..m} prime(i) > n^2.

%F a(n) ~ sqrt(2)*n/sqrt(log n). - _Charles R Greathouse IV_, Apr 19 2022

%o (Python)

%o from sympy import prime

%o def sum_p(m):

%o sum1 = 0

%o for i in range(1, m+1):

%o sum1 += prime(i)

%o return sum1

%o pi = 1

%o for n in range(1, 101):

%o while sum_p(pi) <= n*n:

%o pi += 1

%o print(pi)

%o (PARI) a(n) = my(p=2, s=2); while(s <= n^2, p = nextprime(p+1); s += p); primepi(p); \\ _Michel Marcus_, Oct 26 2020

%o (PARI) first(N)=my(v=vector(N), s, k, n=1, n2=1); forprime(p=2, , s+=p; k++; while(s>n2, v[n]=k; if(n++>N, return(v)); n2=n^2)) \\ _Charles R Greathouse IV_, Apr 19 2022

%o (PARI) a(n)=my(n2=n^2, s, k); forprime(p=2, , s+=p; k++; if(s>n2, return(k))) \\ _Charles R Greathouse IV_, Apr 19 2022

%Y Cf. A000290, A007504.

%K nonn

%O 1,2

%A _Ya-Ping Lu_, Oct 25 2020

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 July 16 17:03 EDT 2024. Contains 374358 sequences. (Running on oeis4.)