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
KEYWORD
nonn
AUTHOR
Ya-Ping Lu, Oct 25 2020
STATUS
approved