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.

A077986 Expansion of 1/(1 + 2*x - x^2 + x^3).

Original entry on oeis.org

1, -2, 5, -13, 33, -84, 214, -545, 1388, -3535, 9003, -22929, 58396, -148724, 378773, -964666, 2456829, -6257097, 15935689, -40585304, 103363394, -263247781, 670444260, -1707499695, 4348691431, -11075326817, 28206844760, -71837707768, 182957587113, -465959726754
Offset: 0

Views

Author

N. J. A. Sloane, Nov 17 2002

Keywords

Crossrefs

Cf. A077939.

Programs

  • GAP
    a:=[1,-2,5];; for n in [4..30] do a[n]:=-2*a[n-1]+a[n-2]-a[n-3]; od; a; # G. C. Greubel, Jun 25 2019
  • Magma
    R:=PowerSeriesRing(Integers(), 30); Coefficients(R!( 1/(1+2*x-x^2+x^3) )); // G. C. Greubel, Jun 25 2019
    
  • Maple
    m:=30; S:=series(1/(1+2*x-x^2+x^3), x, m+1): seq(coeff(S, x, j), j=0..m); # G. C. Greubel, Feb 26 2020
  • Mathematica
    CoefficientList[Series[1/(1+2x-x^2+x^3),{x,0,30}],x] (* or *) LinearRecurrence[ {-2,1,-1},{1,-2,5},30] (* Harvey P. Dale, Feb 14 2014 *)
    b[n_]:= b[n]= If[n<3, n, 2*b[n-1] +b[n-2] +b[n-3]]; Table[(-1)^n*b[n+1], {n, 0, 30}] (* Rigoberto Florez, Jan 23 2020 *)
  • PARI
    Vec(1/(1+2*x-x^2+x^3)+O(x^30)) \\ Charles R Greathouse IV, Sep 26 2012
    
  • Sage
    def A077986_list(prec):
        P. = PowerSeriesRing(ZZ, prec)
        return ( 1/(1+2*x-x^2+x^3) ).list()
    A077986_list(30) # G. C. Greubel, Jun 25 2019
    

Formula

a(n) = (-1)^n * A077939(n). - Joerg Arndt, Sep 30 2012
a(n) = -2*a(n-1) + a(n-2) - a(n-3), with a(0)=1, a(1)=-2, a(2)=5. - Harvey P. Dale, Feb 14 2014