OFFSET
0,2
MATHEMATICA
a[0] = 1; a[1] = 2; a[n_] := a[n] = If[Mod[n, 2] == 0, a[n - 1] - (n - 1)*a[n - 2], 2*(a[n - 1] + (n - 1)*a[n - 2])] b = Table[a[n], {n, 0, 30}]
nxt[{n_, a_, b_}]:={n+1, b, If[OddQ[n], b-n*a, 2(b+n*a)]}; NestList[nxt, {1, 1, 2}, 30][[All, 2]] (* Harvey P. Dale, Jun 12 2020 *)
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Roger L. Bagula, Sep 11 2006
EXTENSIONS
Edited by N. J. A. Sloane, Sep 13 2006
Offset corrected by Jason Yuen, Sep 15 2024
STATUS
approved