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.

A080457 a(1)=3; for n>1, a(n)=a(n-1) if n is already in the sequence, a(n)=a(n-1)+4 otherwise.

Original entry on oeis.org

3, 7, 7, 11, 15, 19, 19, 23, 27, 31, 31, 35, 39, 43, 43, 47, 51, 55, 55, 59, 63, 67, 67, 71, 75, 79, 79, 83, 87, 91, 91, 95, 99, 103, 103, 107, 111, 115, 115, 119, 123, 127, 127, 131, 135, 139, 139, 143, 147, 151, 151, 155, 159, 163, 163, 167, 171, 175
Offset: 1

Views

Author

N. J. A. Sloane and Benoit Cloitre, Mar 20 2003

Keywords

Crossrefs

Programs

  • Magma
    [3+4*(n-2-Floor((n-3)/4)) : n in [1..100]]; // Wesley Ivan Hurt, Jul 15 2015
    
  • Maple
    A080457:=n->3+4*(n-2-floor((n-3)/4)): seq(A080457(n), n=1..100); # Wesley Ivan Hurt, Jul 15 2015
  • Mathematica
    CoefficientList[Series[(3 + 4 x + 4 x^3 + x^4)/((x - 1)^2*(1 + x + x^2 + x^3)), {x, 0, 100}], x] (* Wesley Ivan Hurt, Jul 15 2015 *)
    LinearRecurrence[{1, 0, 0, 1, -1}, {3, 7, 7, 11, 15}, 70] (* Vincenzo Librandi, Jul 16 2015 *)
  • PARI
    main(size)={my(v=vector(size),i,j);v[1]=3;for(j=2,size,x=0;for(i=1,j-1,if(v[i]==j,x=1;break));if(x==1,v[j]=v[j-1],v[j]=v[j-1]+4));return(v);} /* Anders Hellström, Jul 15 2015 */

Formula

a(n) = 3 + 4*(n-2-floor((n-3)/4)).
From Wesley Ivan Hurt, Jul 15 2015: (Start)
G.f.: x*(3+4*x+4*x^3+x^4)/((x-1)^2*(1+x+x^2+x^3)).
a(n) = a(n-1)+a(n-4)-a(n-5), n>5.
a(n) = (6*n-1+(-1)^n-2*(-1)^((2*n+1-(-1)^n)/4))/2. (End)