OFFSET
0,3
LINKS
Harry J. Smith, Table of n, a(n) for n = 0..1000
Index entries for linear recurrences with constant coefficients, signature (0,3,0,-3,0,1).
FORMULA
a(n) = n^( (n+1) (mod 2) + 1 ).
O.g.f.: x*(1+x^2)*(1+4*x-x^2)/(1-x^2)^3. - Len Smiley, Dec 05 2001
MATHEMATICA
Table[ n^ (Mod[n + 1, 2] + 1), {n, 0, 60} ]
PROG
(PARI) a(n) = { if (n%2, n, n^2) } \\ Harry J. Smith, Oct 26 2009
(Magma) /* By the third formula: */ A000217:=func<i | i*(i+1)/2>; [A000217(n)+(-1)^n*A000217(n-1): n in [0..60]]; // Bruno Berselli, Jun 06 2013
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Robert G. Wilson v, Dec 03 2001
STATUS
approved