OFFSET
0,1
LINKS
Robert Israel, Table of n, a(n) for n = 0..10000
FORMULA
The sum of the reciprocals = 0.4304...
EXAMPLE
For n = 2,
2+3+5+7+11=28
3+5+7+11+13=39
5+7+11+13+17=53
so 53 is the first prime that is the sum of 5 consecutive primes
MAPLE
P:= select(isprime, [seq(i, i=3..3000, 2)]):
S:= [0, op(ListTools:-PartialSums(P))]: nS:= nops(S):
R:= NULL:
for n from 1 do
found:= false;
for j from 1 to nS - 2*n + 1 while not found do
v:= S[j+2*n-1]-S[j];
if isprime(v) then R:= R, v; found:= true fi
od;
if not found then break fi;
od:
R; # Robert Israel, Jan 09 2025
MATHEMATICA
Join[{3}, Table[SelectFirst[Total/@Partition[Prime[Range[1000]], 2n+1, 1], PrimeQ], {n, 50}]] (* Requires Mathematica version 10 or later *) (* Harvey P. Dale, Sep 15 2016 *)
PROG
(PARI) \\ First prime that the sum of an odd number of consecutive primes
psumprm(n) = { sr=0; forstep(i=1, n, 2, s=0; for(j=1, i, s+=prime(j); ); for(x=1, n, s = s - prime(x)+ prime(x+i); if(isprime(s), sr+=1.0/s; print1(s" "); break); ); ); print(); print(sr) }
CROSSREFS
KEYWORD
easy,nonn
AUTHOR
Cino Hilliard, May 09 2003
STATUS
approved