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”).

Modulo 2 recursion switch between A000898 and A121966: A000898 first.
2

%I #16 Jun 20 2018 07:17:35

%S 1,2,6,2,40,32,464,272,7040,4864,136448,87808,3177472,2123776,

%T 86861824,57128960,2720112640,1806049280,96095928320,63587041280,

%U 3778819358720,2507078533120,163724570132480,108568842403840,7748467910901760

%N Modulo 2 recursion switch between A000898 and A121966: A000898 first.

%H Robert Israel, <a href="/A122018/b122018.txt">Table of n, a(n) for n = 0..731</a>

%F 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

%p 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:

%p f(0):= 1: f(1):= 2:

%p map(f, [$0..50]); # _Robert Israel_, Jun 20 2018

%t 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}]

%Y Cf. A000898, A121966.

%K nonn

%O 0,2

%A _Roger L. Bagula_, Sep 11 2006

%E Offset changed by _Robert Israel_, Jun 20 2018