OFFSET
0,2
LINKS
Vincenzo Librandi, Table of n, a(n) for n = 0..1000
Index entries for linear recurrences with constant coefficients, signature (1,0,0,1,-1).
FORMULA
From Bruno Berselli, Jan 23 2011: (Start)
G.f.: x*(4+2*x+5*x^2+x^3)/((1-x)*(1-x^4)).
a(n) = (12*n+i*(i^n-(-i)^n)-3*(-1)^n+3)/4, where i is the imaginary unit.
a(n) = A131743(n) + 3*n. (End)
a(n) = +1*a(n-1)+1*a(n-4)-1*a(n-5) for n>=5. [Joerg Arndt, Jan 25 2011]
MAPLE
U:=n->if n mod 2 = 0 then 3*n elif n mod 4 = 1 then 3*n+1 else 3*n+2; fi;
MATHEMATICA
fn[n_]:=Which[EvenQ[n], 3n, Mod[n, 4]==1, 3n+1, Mod[n, 4]==3, 3n+2]; Array[fn, 70, 0] (* Harvey P. Dale, May 03 2013 *)
CoefficientList[Series[x (4 + 2 x + 5 x^2 + x^3) / ((1 - x) (1 - x^4)), {x, 0, 40}], x] (* Vincenzo Librandi, Jun 19 2013 *)
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
N. J. A. Sloane, Jan 21 2011
EXTENSIONS
Definition corrected by N. J. A. Sloane, Jan 23 2011
STATUS
approved