login
Largest prime less than or equal to the sum of first n primes (A007504).
1

%I #10 Jul 24 2022 17:53:45

%S 2,5,7,17,23,41,53,73,97,127,157,197,233,281,317,379,439,499,563,631,

%T 709,787,863,953,1051,1153,1259,1367,1471,1583,1709,1847,1987,2113,

%U 2273,2423,2579,2741,2909,3083,3259,3433,3637,3823,4027,4219,4423,4657

%N Largest prime less than or equal to the sum of first n primes (A007504).

%H Harry J. Smith, <a href="/A066039/b066039.txt">Table of n, a(n) for n = 1..1000</a>

%e a(3) = 7 because 7 is the first prime <= 10 = 2+3+5. a(4) = 17 because 17 is a prime and is equal to 2+3+5+7.

%t If[PrimeQ[#],#,NextPrime[#,-1]]&/@Accumulate[Prime[Range[50]]] (* _Harvey P. Dale_, Jul 24 2022 *)

%o (PARI) { s=0; for (n=1, 1000, s+=prime(n); a=precprime(s); write("b066039.txt", n, " ", a) ) } \\ _Harry J. Smith_, Nov 08 2009

%K nonn

%O 1,1

%A _Robert G. Wilson v_, Dec 12 2001

%E Previous Mathematica program replaced by _Harvey P. Dale_, Jul 24 2022