proposed
approved
proposed
approved
editing
proposed
a(n) = (1/2)*(1 - (-1)^n) + Sum_{j=1..n} d[(j], ), where d[(j] ) = A000166(nj) are the derangement numbers.
proposed
editing
editing
proposed
a(n) = (1/2)[*(1 - (-1)^n] ) + Sum_{j=1..n} d[j], where d[j] = A000166(n) are the derangement numbers.
Conjecture: D-finite with recurrence a(n) +(- (n+-1)*a(n-1) +(- (n+-1)*a(n-2) +(n-1)*a(n-3) + (n-2)*a(n-4) = 0. - R. J. Mathar, Jul 01 2022
a[0] = 1; a[n_] := a[n] = n*a[n - 1] + (-1)^n; f[n_] := Sum[(n - k) a[n - k - 1], {k, 0, n - 1}]; Array[f, 20] (* Robert G. Wilson v, Apr 01 2011 *)
(Magma)
A000166:= func< n | Factorial(n)*(&+[(-1)^j/Factorial(j): j in [0..n]]) >;
A177265:= func< n | n le 2 select 1 else Self(n-1) + n*A000166(n-1) >;
[A177265(n): n in [1..30]]; // G. C. Greubel, May 19 2024
(SageMath)
def A000166(n): return factorial(n)*sum((-1)^j/factorial(j) for j in range(n+1))
def a(n): return 1 if n<3 else a(n-1) + n*A000166(n-1) # a = A177265
[a(n) for n in range(1, 31)] # G. C. Greubel, May 19 2024
approved
editing
proposed
approved
editing
proposed
Cf. A000240.
proposed
editing
editing
proposed
Empirically the partial sums of A000240. - Sean A. Irvine, Jul 12 2022
approved
editing