[go: up one dir, main page]

login
A166117
a(0)=0, a(1)=1, a(2)=2 and a(n) = a(n-1) - 2a(n-2) + a(n-3).
1
0, 1, 2, 0, -3, -1, 5, 4, -7, -10, 8, 21, -5, -39, -8, 65, 42, -96, -115, 119, 253, -100, -487, -34, 840, 421, -1293, -1295, 1712, 3009, -1710, -6016, 413, 10735, 3893, -17164, -14215, 24006, 35272, -26955, -73493, 15689, 135720, 30849, -224902
OFFSET
0,3
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
Cf. A078051.
Sequence in context: A008798 A005290 A326440 * A078051 A130627 A006209
KEYWORD
sign,easy
AUTHOR
Barry Wells (wells.barry(AT)gmail.com), Oct 06 2009
STATUS
approved