OFFSET
0,2
LINKS
Robert Israel, Table of n, a(n) for n = 0..731
FORMULA
For n>=2, a(n) = a(n-1) - (n-1)*a(n-2) if n is odd, a(n) = 2*a(n-1) + 2*(n-1)*a(n-2) if n is even. - Edited by Robert Israel, Jun 20 2018
MAPLE
f:= proc(n) option remember; if n::odd then procname(n-1)-(n-1)*procname(n-2) else 2*procname(n-1)+2*(n-1)*procname(n-2) fi end proc:
f(0):= 1: f(1):= 2:
map(f, [$0..50]); # Robert Israel, Jun 20 2018
MATHEMATICA
a[0] = 1; a[1] = 2; a[n_] := a[n] = If[Mod[n, 2] == 1, a[n - 1] - (n - 1)*a[n - 2], 2*(a[n - 1] + (n - 1)*a[n - 2])] b = Table[a[n], {n, 0, 30}]
CROSSREFS
KEYWORD
nonn
AUTHOR
Roger L. Bagula, Sep 11 2006
EXTENSIONS
Offset changed by Robert Israel, Jun 20 2018
STATUS
approved