OFFSET
0,3
LINKS
Alois P. Heinz, Table of n, a(n) for n = 0..1000
Index entries for linear recurrences with constant coefficients, signature (1,-2,1).
FORMULA
a(n) = n for n<3, else a(n) = a(n-1) - 2*a(n-2) + a(n-3).
G.f.: -(x+1)*x/(x^3-2*x^2+x-1). - Alois P. Heinz, Sep 30 2013
a(n) = (-1)^(1+n)*A078051(n-1). - R. J. Mathar, Feb 05 2016
EXAMPLE
a(0)=0, a(1)=1, a(2)=2, a(3) = 2-2(1)+0 = 0, a(4)= 0-2(2)+ 1 = -3, a(5) = -3 -2(0) + 2 = -1, a(6)= -1 -2(-3)+ 0 = 5.
MAPLE
a:= proc(n) a(n):=`if`(n<3, n, a(n-1)-2*a(n-2)+a(n-3)) end:
seq(a(n), n=0..50); # Alois P. Heinz, Sep 30 2013
MATHEMATICA
LinearRecurrence[{1, -2, 1}, {0, 1, 2}, 10] (* G. C. Greubel, Apr 26 2016 *)
CROSSREFS
KEYWORD
sign,easy
AUTHOR
Barry Wells (wells.barry(AT)gmail.com), Oct 06 2009
STATUS
approved