cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

Showing 1-4 of 4 results.

A071194 Length (>1) of shortest sequence of consecutive primes starting with prime(n) whose sum is also prime, or -1 if no such sequence exists.

Original entry on oeis.org

2, 9, 3, 3, 3, 5, 3, 3, 3, 3, 3, 9, 3, 5, 7, 3, 5, 3, 3, 3, 5, 3, 3, 7, 7, 3, 7, 5, 3, 5, 5, 9, 5, 3, 3, 5, 3, 3, 11, 9, 5, 21, 5, 9, 3, 9, 3, 5, 55, 3, 7, 27, 9, 27, 7, 5, 5, 3, 9, 3, 3, 3, 5, 3, 7, 7, 11, 3, 3, 3, 5, 5, 7, 7, 3, 5, 3, 9, 3, 3, 5, 11, 3, 5, 47, 5, 3, 3, 5, 3, 3, 5, 7, 3, 3, 7, 3, 5, 5, 5, 3
Offset: 1

Views

Author

Labos Elemer, May 16 2002

Keywords

Examples

			For n=1, start-prime = prime(1) = 2, 2+3=5 is prime, length=2, so a(1)=2;
for n=2, start-prime = prime(2) = 3, 3 + 5 + 7 + 11 + 13 + 17 + 19 + 23 + 29 = 127 is prime, length=9, all shorter partial sums are composite, so a(2)=9;
for n=160, prime(160) = 941, 941 + ... + 1609 = 121123 is prime, a(160)=95.
		

Crossrefs

Programs

  • Mathematica
    Table[k = 2; While[CompositeQ@ Total@ Prime@ Range[n, n + k], k++]; k + 2 Boole[EvenQ@ k] - 1, {n, 120}] (* Michael De Vlieger, Jan 01 2017 *)
  • PARI
    a(n,p=prime(n))=my(q=p,t=2); while(!isprime(p+=q=nextprime(q+1)),t++);t
    apply(p->a(0,p), primes(30)) \\ Charles R Greathouse IV, Jun 16 2015

Extensions

Escape clause added by N. J. A. Sloane, Nov 17 2020

A071196 The sum of the sequence starting with prime(n) and having prime sum defined in A071194, or -1 if no such sequence exists.

Original entry on oeis.org

5, 127, 23, 31, 41, 101, 59, 71, 83, 97, 109, 479, 131, 263, 431, 173, 331, 199, 211, 223, 421, 251, 269, 719, 757, 311, 827, 587, 349, 647, 683, 1367, 733, 439, 457, 811, 487, 503, 2141, 1747, 941, 5009, 991, 1951, 607, 2053, 661, 1151, 21139, 701, 1753
Offset: 1

Views

Author

Labos Elemer, May 16 2002

Keywords

Examples

			n=25: prime(25)=97, sum=97+101+103+107+109+113+127=757=a(25), prime; shorter (length>1) partial sums are composite: {97,198,301,408,517,630,757}.
		

Crossrefs

Programs

  • Mathematica
    Table[sm = Prime[k] + Prime[k + 1]; g = 1; While[ ! PrimeQ[sm], g++; sm = sm + Prime[k + g]]; sm, {k, 1, 51}] (* Lei Zhou, Dec 02 2005 *)
  • PARI
    { forprime (p=2, prime(51), s=p; forprime (q=p+1, oo, if (isprime(s+=q), print1 (s", "); break))) } \\ Rémy Sigrist, Nov 17 2020

Extensions

Edited and escape clause added by N. J. A. Sloane, Nov 17 2020~

A071195 Final prime in sequence of primes starting with prime(n) and having prime sum (see A071194), or -1 if no such sequence exists.

Original entry on oeis.org

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

Views

Author

Labos Elemer, May 16 2002

Keywords

Comments

The length of the sequence is given in A071194.

Examples

			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.
		

Crossrefs

Programs

  • Mathematica
    Prime@ Table[k = 1; While[! PrimeQ@ Total@ Prime@ Range[n, n + k], k++]; n + k, {n, 57}] (* Michael De Vlieger, Mar 25 2017 *)
  • 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

Extensions

Edited and escape clause added by N. J. A. Sloane, Nov 17 2020

A071197 Possible prime values in A071195.

Original entry on oeis.org

3, 11, 13, 17, 23, 29, 31, 37, 41, 47, 61, 71, 73, 79, 89, 97, 107, 113, 127, 131, 137, 139, 149, 151, 157, 167, 173, 197, 211, 223, 227, 239, 251, 269, 281, 283, 293, 307, 311, 317, 331, 349, 353, 359, 379, 383, 389, 397, 401, 409, 419, 421, 439, 443, 457
Offset: 1

Views

Author

Labos Elemer, May 16 2002

Keywords

Crossrefs

Showing 1-4 of 4 results.