OFFSET
0,4
LINKS
Index entries for linear recurrences with constant coefficients, signature (2,0,-2,1).
FORMULA
For n>=4, a(n) = (n-2)^2 - a(n-1). - Alex Ratushnyak, Aug 03 2012
G.f.: x*(-4*x^4+2*x^5+x-1)/((1+x)*(x-1)^3). - N. J. A. Sloane, Sep 28 2009
a(n)= n^2/2-3*n/2+1-(-1)^n, n>2. - N. J. A. Sloane, Sep 28 2009
MATHEMATICA
Clear[M, m, v, aa] (*A107386*)m = 2; M = {{0, 1, 0, 0}, {0, 0, 1, 0}, {0, 0, 0, 1}, {1, m, 0, - m}}; Expand[Det[M - x*IdentityMatrix[4]]] ; NSolve[Det[M - x*IdentityMatrix[4]] == 0, x] ; v[1] = {0, 1, 1, 2}; v[n_] := v[n] = M . v[n - 1]; digits = 50; aa = Table[Abs[v[n][[1]]], {n, 1, digits}]
a=2; lst={0, 1, 1, a}; Do[a=n^2-a; AppendTo[lst, a], {n, 2, 5!}]; lst (* Vladimir Joseph Stephan Orlovsky, Dec 17 2008 *)
LinearRecurrence[{2, 0, -2, 1}, {0, 1, 1, 2, 2, 7, 9}, 50] (* Harvey P. Dale, Dec 07 2021 *)
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Roger L. Bagula, May 24 2005, corrected Sep 04 2008
EXTENSIONS
Definition replaced by recurrence by the Associate Editors of the OEIS, Sep 28 2009
STATUS
approved