OFFSET
0,3
LINKS
Paolo Xausa, Table of n, a(n) for n = 0..440
FORMULA
a(n) = n! - (n - 1)! + Sum_{k=1..n} (n + 1 - k)*(k - 1)! for n > 0.
MATHEMATICA
A339034[n_] := If[n == 0, 1, n! + Sum[(n+1-k)*(k-1)!, {k, n-1}]];
Array[A339034, 25, 0] (* Paolo Xausa, Jan 31 2024 *)
PROG
(SageMath)
def A339034(n):
if n == 0: return 1
d = factorial(n) - factorial(n - 1)
return add((n + 1 - k)*factorial(k - 1) for k in (1..n)) + d
print([A339034(n) for n in (0..22)])
(PARI) a(n) = if (n==0, 1, n! - (n-1)! + sum(k=1, n, (n+1-k)*(k-1)!)); \\ Michel Marcus, Dec 02 2020
CROSSREFS
KEYWORD
nonn
AUTHOR
Peter Luschny, Nov 20 2020
STATUS
approved