login
Largest k such that A007504(k) <= n^2.
0

%I #25 Apr 19 2022 07:39:40

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

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

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

%N Largest k such that A007504(k) <= n^2.

%F a(n) = A337769(n) - 1.

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

%F a(n) = A350174(n^2). - _Kevin Ryde_, Apr 19 2022

%o (Python)

%o from sympy import prime

%o def a(n):

%o k = 1

%o total = 0

%o while True:

%o total += prime(k)

%o if total > n**2:

%o break

%o k += 1

%o return k-1

%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-1; if(n++>N, return(v)); n2=n^2)) \\ _Charles R Greathouse IV_, Apr 18 2022

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

%Y Cf. A000290, A007504, A337769, A350174, A033997.

%K nonn

%O 1,3

%A _Joelle H. Kassir_, Apr 17 2022