login
a(0)=1; for n>0, a(n) = a(n-1)*n+1 if n is even, (a(n-1)+1)*n otherwise.
5

%I #44 May 18 2021 14:47:32

%S 1,2,5,18,73,370,2221,15554,124433,1119906,11199061,123189682,

%T 1478276185,19217590418,269046265853,4035693987810,64571103804961,

%U 1097708764684354,19758757764318373,375416397522049106,7508327950440982121,157674886959260624562

%N a(0)=1; for n>0, a(n) = a(n-1)*n+1 if n is even, (a(n-1)+1)*n otherwise.

%F E.g.f.: (x+1)*cosh(x)/(1-x). - _Alois P. Heinz_, May 14 2021

%F Lim_{n->infinity} a(n)/n! = 2*cosh(1) = A137204 = 2*A073743. - _Amrit Awasthi_, May 15 2021

%F a(n) = A344317(n) - A155521(n-1) for n > 0. - _Alois P. Heinz_, May 18 2021

%e a(0) = 1;

%e a(1) = (a(0)+1)*1 = (1+1)*1 = 2;

%e a(2) = (a(1)*2)+1 = (2*2)+1 = 5;

%e a(3) = (a(2)+1)*3 = (5+1)*3 = 18;

%e a(4) = (a(3)*4)+1 = (18*4)+1 = 73;

%e a(5) = (a(4)+1)*5 = (73+1)*5 = 370.

%p a:= proc(n) a(n):= n*a(n-1) + n^(n mod 2) end: a(0):= 1:

%p seq(a(n), n=0..22); # _Alois P. Heinz_, May 14 2021

%t a[1] = 1; a[n_] := a[n] = If[OddQ[n], (n - 1)*a[n - 1] + 1, (n - 1)*(a[n - 1] + 1)]; Array[a, 25] (* _Amiram Eldar_, May 13 2021 *)

%Y Cf. A033540, A073743, A090805, A137204, A155521, A344317.

%K nonn

%O 0,2

%A _Amrit Awasthi_, May 13 2021