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-3 of 3 results.

A062042 a(1) = 2, a(n) = least number greater than a(n-1) such that a(n-1) + a(n) is a prime.

Original entry on oeis.org

2, 3, 4, 7, 10, 13, 16, 21, 22, 25, 28, 31, 36, 37, 42, 47, 50, 51, 52, 55, 58, 69, 70, 79, 84, 89, 90, 91, 100, 111, 112, 115, 118, 121, 130, 133, 136, 141, 142, 151, 156, 157, 160, 171, 176, 177, 182, 185, 188, 191, 192, 197, 200, 201, 208, 211, 220, 223, 226
Offset: 1

Views

Author

Amarnath Murthy, Jun 05 2001

Keywords

Examples

			a(5) = 10 and the least number more than 10 that gives a prime when increased by 10 is 13, 13 + 10 = 23.
		

Crossrefs

Cf. A062044.

Programs

  • Maple
    A[1]:= 2;
    for n from 2 to 100 do
      A[n]:= nextprime(2*A[n-1])-A[n-1]
    od:
    seq(A[n],n=1..100); # Robert Israel, Aug 28 2018
  • Mathematica
    a=2;lst={a};Do[b=a+1;While[ !PrimeQ[a+b],b++ ];AppendTo[lst,b];a=b,{n,5!}];lst (* Vladimir Joseph Stephan Orlovsky, Feb 07 2010 *)
    NestList[NextPrime[2#]-#&,2,60] (* Harvey P. Dale, Jul 20 2011 *)
  • PARI
    FirstTerms(n)={my(x=2,y,a=vector(n),j=1);a[1]=2;while(j++<=n,y=x+1;while(!isprime(x+y),y++);x=y;a[j]=y);return(a)} \\ R. J. Cano, Jan 18 2017

Extensions

More terms from Larry Reeves (larryr(AT)acm.org), Jun 06 2001

A213815 Arithmetic mean of next a(n) successive nonnegative integers is prime.

Original entry on oeis.org

5, 1, 3, 5, 7, 5, 7, 9, 3, 5, 7, 5, 11, 1, 11, 9, 7, 1, 3, 5, 7, 21, 3, 17, 11, 9, 3, 1, 19, 21, 3, 5, 7, 5, 19, 5, 7, 9, 3, 17, 11, 1, 7, 21, 11, 1, 11, 5, 7, 5, 3, 9, 7, 1, 15, 5, 19, 5, 7, 9, 3, 5, 19, 5, 11, 9, 15, 25, 7, 5, 7, 9, 11, 1, 11, 5, 7, 1, 3
Offset: 1

Views

Author

Alex Ratushnyak, Jul 18 2012

Keywords

Comments

Corresponding primes: A062044(n).

Examples

			(0+1+2+3+4)/5 = 2 is prime, so a(1)=5,
then 5/1 = 5 is prime, so a(2)=1,
then (6+7+8)/3 = 7 is prime, so a(3)=3.
		

Crossrefs

Programs

  • Maple
    R:= 5: count:= 1: r:= 4:
    for count from 2 to 100 do
        s:= nextprime(r);
        R:= R,2*(s-r)-1;
        r:= 2*s - r - 1;
    od:
    R; # Robert Israel, Feb 28 2025

A214362 Arithmetic mean of next a(n) successive positive integers is prime.

Original entry on oeis.org

3, 3, 1, 7, 5, 7, 5, 11, 1, 7, 5, 7, 9, 3, 9, 11, 5, 3, 1, 7, 5, 23, 1, 19, 9, 11, 1, 3, 17, 23, 1, 7, 5, 7, 17, 7, 5, 11, 1, 19, 9, 3, 5, 23, 9, 3, 9, 7, 5, 7, 1, 11, 5, 3, 13, 7, 17, 7, 5, 11, 1, 7, 17, 7, 9, 11, 13, 27, 5, 7, 5, 11, 9, 3, 9, 7, 5, 3, 1, 23, 1
Offset: 1

Views

Author

Alex Ratushnyak, Jul 18 2012

Keywords

Comments

Corresponding primes: A062044(n).
All terms are odd. - Robert Israel, Jan 17 2017

Examples

			(1+2+3)/3 = 2 is prime, so a(1)=3,
then (4+5+6)/3 = 5 is prime, so a(2)=3,
then 7/1 = 7 is prime, so a(3)=1,
then (8+9+10+11+12+13+14)/7 = 11 is prime, so a(4)=7.
		

Crossrefs

Programs

  • Maple
    t:= 1:
    for n from 1 to 100 do
      for s from 1 by 2 do
        if isprime((2*t + s - 1)/2) then
          A[n]:= s; t:= t+s; break
        fi
    od od:
    seq(A[n],n=1..100); # Robert Israel, Jan 17 2017
  • PARI
    firstTerms(n)={
    my(k=1,j=1,x,y,a=vector(n));
    while(j<=n,x=0;while(!isprime(k+x),x++);y=2*x+1;k+=y;a[j]=y;j++);
    return(a)} \\ R. J. Cano, Jan 17 2017

Formula

a(n) = 2*(A062042(n)-A062042(n-1))+(-1)^n for n >= 2. - Robert Israel, Jan 17 2017
Showing 1-3 of 3 results.