The OEIS is supported by the many generous donors to the OEIS Foundation.

 Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 59th year, we have over 358,000 sequences, and we’ve crossed 10,300 citations (which often say “discovered thanks to the OEIS”). Other ways to Give
 Hints (Greetings from The On-Line Encyclopedia of Integer Sequences!)
 A051935 a(n) = smallest number > a(n-1) such that a(1) + a(2) + ... + a(n) is a prime. 6
 2, 3, 6, 8, 10, 12, 18, 20, 22, 26, 30, 34, 36, 42, 44, 46, 50, 52, 60, 66, 72, 74, 76, 78, 80, 82, 102, 108, 114, 116, 118, 126, 128, 132, 136, 138, 144, 146, 150, 154, 158, 162, 166, 170, 174, 186, 196, 198, 210, 222, 228, 236, 240, 244, 246, 254, 270, 280, 282 (list; graph; refs; listen; history; text; internal format)
 OFFSET 1,1 LINKS David A. Corneth, Table of n, a(n) for n = 1..10000 (first 2000 terms form T. D. Noe) Code Golf StackExchange, Compute the minimum a(n)>a(n-1) such that a(1)+a(2)+ ... +a(n) is prime, coding challenge started Aug 17 2018. EXAMPLE The third term is 6 because 2 + 3 + 6 = 11 is a prime. MATHEMATICA p=2; lst={p}; Do[If[PrimeQ[p+n], AppendTo[lst, n]; p=p+n], {n, 3, 10^3}]; lst (* Vladimir Joseph Stephan Orlovsky, Aug 14 2008 *) nxt[{t_, a_}]:=Module[{k=a+1}, While[!PrimeQ[t+k], k++]; {t+k, k}]; Transpose[ NestList[ nxt, {2, 2}, 60]][[2]] (* Harvey P. Dale, Apr 10 2016 *) nxt[{t_, a_}]:=Module[{k=a+1}, k=NextPrime[t+k-1]-t; {t+k, k}]; NestList[ nxt, {2, 2}, 60][[All, 2]] (* More efficient than the program immediately above *) (* Harvey P. Dale, Aug 26 2019 *) PROG (Perl) use ntheory ":all"; my(\$s, @L)=(2, 2); for (1..99) { push @L, next_prime(\$s+\$L[-1])-\$s; \$s+=\$L[-1]; } print "[@L]\n"; # Dana Jacobsen, Sep 25 2018 (PARI) first(n) = {my(res = vector(n), os = 2, ns); res[1] = 2; for(i = 2, n, ns = nextprime(os + res[i-1] + 1); res[i] = ns - os; os = ns); res} \\ David A. Corneth, Aug 26 2019 (Python) from sympy import isprime from itertools import islice def agen(): # generator of terms yield from [2, 3] s, an = 5, 4 while True: while not isprime(s+an): an += 2 yield an an, s = an+2, s+an print(list(islice(agen(), 60))) # Michael S. Branicky, Oct 30 2022 CROSSREFS Cf. A051934. Sequence in context: A089422 A316571 A165780 * A324690 A181486 A179785 Adjacent sequences: A051932 A051933 A051934 * A051936 A051937 A051938 KEYWORD easy,nice,nonn AUTHOR Felice Russo, Dec 21 1999 STATUS approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

Last modified November 30 01:31 EST 2022. Contains 358431 sequences. (Running on oeis4.)