login
A337769
Smallest integer m such that the sum of the first m prime numbers is greater than n^2.
2
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, 22, 22, 23, 24, 24, 25, 26, 26, 27, 28, 28, 29, 30, 31, 31, 32, 32, 33, 34, 34, 35, 36, 36, 37, 38, 38, 39, 40, 40, 41, 41, 42, 43, 43, 44, 45, 45, 46, 46, 47, 48, 48
OFFSET
1,2
FORMULA
a(n) = Min{m}, Sum_{i=1..m} prime(i) > n^2.
a(n) ~ sqrt(2)*n/sqrt(log n). - Charles R Greathouse IV, Apr 19 2022
PROG
(Python)
from sympy import prime
def sum_p(m):
sum1 = 0
for i in range(1, m+1):
sum1 += prime(i)
return sum1
pi = 1
for n in range(1, 101):
while sum_p(pi) <= n*n:
pi += 1
print(pi)
(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
(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
(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
CROSSREFS
Sequence in context: A086706 A100470 A071604 * A061069 A122256 A122262
KEYWORD
nonn
AUTHOR
Ya-Ping Lu, Oct 25 2020
STATUS
approved