login
A344935
a(0)=1; for n > 0, a(n) = n*(a(n-1) + i^(n-1)) if n is odd, n*a(n-1) + i^n otherwise, where i = sqrt(-1).
1
1, 2, 3, 6, 25, 130, 779, 5446, 43569, 392130, 3921299, 43134278, 517611337, 6728947394, 94205263515, 1413078952710, 22609263243361, 384357475137154, 6918434552468771, 131450256496906630, 2629005129938132601, 55209107728700784642, 1214600370031417262123
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