OFFSET
0,2
FORMULA
E.g.f.: (1+x)*cos(x)/(1-x).
Lim_{n->infinity} a(n)/n! = 2*cos(1) = 2*A049470.
D-finite with recurrence a(n) -n*a(n-1) +2*a(n-2) +2*(-n+2)*a(n-3) +a(n-4) +(-n+4)*a(n-5)=0. - R. J. Mathar, Aug 19 2022
EXAMPLE
a(0) = 1;
a(1) = 1*(a(0) + i^(1-1)) = 2;
a(2) = 2*a(1) + i^2 = 3;
a(3) = 3*(a(2) + i^2) = 6;
a(4) = 4*a(3) + i^4 = 25.
MAPLE
A344935 := proc(n)
option remember ;
if n = 0 then
1;
elif type(n, 'odd') then
n*(procname(n-1)+I^(n-1)) ;
else
n*procname(n-1)+I^n ;
end if;
simplify(%) ;
end proc:
seq(A344935(n), n=0..40) ; # R. J. Mathar, Aug 19 2022
MATHEMATICA
a[0] = 1; a[n_] := a[n] = If[OddQ[n], n*(a[n - 1] + I^(n - 1)), n*a[n - 1] + I^n]; Array[a, 30, 0] (* Amiram Eldar, Jun 03 2021 *)
PROG
(PARI) a(n) = if (n==0, 1, if (n%2, n*(a(n-1) + I^(n-1)), n*a(n-1) + I^n)); \\ Michel Marcus, Jun 05 2021
CROSSREFS
KEYWORD
nonn
AUTHOR
Amrit Awasthi, Jun 03 2021
STATUS
approved