OFFSET
1,1
FORMULA
Sum of reciprocals converges to 0.28053...
a(n) = A070281(prime(n)). - Michel Marcus, Aug 07 2021
EXAMPLE
For prime(2) = 3,
2+3+5 = 10,
3+5+7 = 15,
5+7+11 = 23,
7+11+13 = 31.
So a(2) = 23, the first prime that is the sum of 3 consecutive primes.
PROG
(PARI)
\\ First prime in the sum of a prime number of consecutive primes
upto(n) = { sr=.2; print1(5", "); forprime(i=2, n, 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)*/}
(Python)
from sympy import isprime, nextprime, prime, primerange
def a(n):
pn = prime(prime(n))
smallest = list(primerange(2, pn+1))
while not isprime(sum(smallest)):
pn = nextprime(pn)
smallest = smallest[1:] + [pn]
return sum(smallest)
print([a(n) for n in range(1, 42)]) # Michael S. Branicky, May 23 2021
CROSSREFS
KEYWORD
easy,nonn
AUTHOR
Cino Hilliard, May 09 2003
STATUS
approved