OFFSET
0,1
LINKS
Vincenzo Librandi, Table of n, a(n) for n = 0..1000
Index entries for linear recurrences with constant coefficients, signature (1,1,1,2).
FORMULA
First differences of A180343(n).
G.f.: ( -2 + 3*x - x^3 + 2*x^2 ) / ( (2*x-1)*(1+x)*(1+x^2) ). - R. J. Mathar, Jan 26 2011
a(n) = 4*(-1)^floor((n+1)/2)*A000034(n+1)/5 + 2^n/15 + (-1)^n/3. - R. J. Mathar, Jan 26 2011
a(n) = a(n-4) + 2^(n-4).
a(n) = a(n-2) + (-3,2,4,0,0,8,16,24,=sixth differences of A007910(n-1) = 0,0,1,2,3,6,13 or fifth differences of A007909(n); also -3,2,4,8*A007910(n-1)).
a(n) = a(n-1) + a(n-2) + a(n-3) + 2*a(n-4). - Vincenzo Librandi, Jun 17 2012
MAPLE
A000034 := proc(n) if type(n, 'even') then 1 ; else 2 ; end if; end proc:
A161204 := proc(n) 4*(-1)^floor((n+1)/2)*A000034(n+1)/5+2^n/15+(-1)^n/3 ; end proc: # R. J. Mathar, Jan 26 2011
MATHEMATICA
CoefficientList[Series[(-2+3*x-x^3+2*x^2)/((2*x-1)*(1+x)*(1+x^2)), {x, 0, 40}], x] (* Vincenzo Librandi, Jun 17 2012 *)
LinearRecurrence[{1, 1, 1, 2}, {2, -1, -1, 1}, 40] (* Harvey P. Dale, Dec 01 2019 *)
PROG
(Magma) I:=[2, -1, -1, 1]; [n le 4 select I[n] else Self(n-1)+Self(n-2)+Self(n-3)+2*Self(n-4): n in [1..40]]; // Vincenzo Librandi, Jun 17 2012
CROSSREFS
KEYWORD
sign,easy
AUTHOR
Paul Curtz, Jan 20 2011
STATUS
approved