login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

A122017
a(n) = if n even then a(n - 1) - (n - 1)*a(n - 2) otherwise 2*(a(n - 1) + (n - 1)*a(n - 2)).
0
1, 2, 1, 10, 7, 94, 59, 1246, 833, 21602, 14105, 460250, 305095, 11656190, 7689955, 341753230, 226403905, 11388911170, 7540044785, 425080891690, 281820040775, 17566875749150, 11648654892875, 796239842748350, 528320780212225
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
Sequence in context: A225470 A081099 A213252 * A219900 A136233 A113088
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