login
A071195
Final prime in sequence of primes starting with prime(n) and having prime sum (see A071194), or -1 if no such sequence exists.
5
3, 29, 11, 13, 17, 29, 23, 29, 31, 37, 41, 71, 47, 61, 73, 61, 73, 71, 73, 79, 97, 89, 97, 113, 127, 107, 137, 131, 127, 139, 149, 173, 157, 151, 157, 173, 167, 173, 227, 223, 197, 293, 211, 239, 211, 251, 227, 239, 563, 239, 269, 397, 283, 409, 283, 281, 283
OFFSET
1,1
COMMENTS
The length of the sequence is given in A071194.
LINKS
Charles R Greathouse IV, Table of n, a(n) for n = 1..10000
EXAMPLE
n=2: p(2)=3, 3+7+11+13+17+19+23+29 = 127 is the shortest partial sum with initial prime 3; it ends with p(10) = 29 = a(2);
n=6: p(6)=13, 13+17+19+23+29 = 101, so the end-prime = a(6) = 29.
MATHEMATICA
Prime@ Table[k = 1; While[! PrimeQ@ Total@ Prime@ Range[n, n + k], k++]; n + k, {n, 57}] (* Michael De Vlieger, Mar 25 2017 *)
PROG
(PARI) a(n, p=prime(n))=my(q=p); while(!isprime(p+=q=nextprime(q+1)), ); q
apply(p->a(0, p), primes(30)) \\ Charles R Greathouse IV, Jun 16 2015
CROSSREFS
KEYWORD
nonn
AUTHOR
Labos Elemer, May 16 2002
EXTENSIONS
Edited and escape clause added by N. J. A. Sloane, Nov 17 2020
STATUS
approved