A078001 Expansion of (1-x)/(1-2*x+x^2+x^3).
1, 1, 1, 0, -2, -5, -8, -9, -5, 7, 28, 54, 73, 64, 1, -135, -335, -536, -602, -333, 472, 1879, 3619, 4887, 4276, 46, -9071, -22464, -35903, -40271, -22175, 31824, 126094, 242539, 327160, 285687, 1675, -609497, -1506356, -2404890, -2693927, -1476608, 2145601, 8461737, 16254481, 21901624
Offset: 0
Links
- G. C. Greubel, Table of n, a(n) for n = 0..1000
- Index entries for linear recurrences with constant coefficients, signature (2, -1, -1).
Programs
-
GAP
a:=[1,1,1];; for n in [4..50] do a[n]:=2*a[n-1]-a[n-2]-a[n-3]; od; a; # G. C. Greubel, Jun 27 2019
-
Magma
R
:=PowerSeriesRing(Integers(), 50); Coefficients(R!( (1-x)/( 1-2*x+x^2+x^3) )); // G. C. Greubel, Jun 27 2019 -
Mathematica
CoefficientList[Series[(1-x)/(1-2x+x^2+x^3),{x,0,50}],x] (* or *) LinearRecurrence[{2,-1,-1},{1,1,1},50] (* Harvey P. Dale, Nov 03 2013 *)
-
PARI
Vec((1-x)/(1-2*x+x^2+x^3)+O(x^50)) \\ Charles R Greathouse IV, Sep 26 2012
-
Python
a = [1]*1000 for n in range(55): print(a[n], end=',') sum=0 for k in range(n-1): sum+=a[k] a[n+1] = a[n]-sum # from Alex Ratushnyak, May 03 2012
-
Sage
((1-x)/(1-2*x+x^2+x^3)).series(x, 50).coefficients(x, sparse=False) # G. C. Greubel, Jun 27 2019
Formula
a(n) = Sum_{k=0..floor(n/3)} (-1)^k*binomial(n-k, 2*k). - Vladeta Jovovic, Feb 10 2003
a(0)=1, a(n+1) = a(n) - Sum_{k=0..n-2} a(k). - Alex Ratushnyak, May 03 2012
a(0)=1, a(1)=1, a(2)=1, a(n) = 2*a(n-1)-a(n-2)-a(n-3). - Harvey P. Dale, Nov 03 2013