%I #21 Sep 08 2022 08:45:22
%S 1,2,8,48,400,4390,60624,1013404,19881728,447085170,11319529600,
%T 318298578664,9834869311488,331059072378814,12055438037135360,
%U 472096504892128500,19781301201305534464,882991510898240350666,41828674437875442696192,2095750482492627217639360
%N a(n) = Sum_{k=0..n} (n-k)! * n^k.
%C This sequence appears in the calculation of the expectation of the number of runs of an n-faced die, stopping when a face appears for the second time.
%H G. C. Greubel, <a href="/A112541/b112541.txt">Table of n, a(n) for n = 0..350</a>
%F a(n) = Sum_{k=0..n} k! * n^(n-k). - _G. C. Greubel_, Jan 12 2022
%p A112541 := proc(n)
%p add((n-k)!*n^k,k=0..n) ;
%p end proc:
%p seq(A112541(n),n=0..13) ; # _R. J. Mathar_, Dec 16 2015
%t f[n_]:= Sum[(n-k)!n^k, {k, 0, n}]; Array[f, 17] (* _Robert G. Wilson v_, , Dec 22 2005 *)
%o (Magma) [(&+[Factorial(k)*n^(n-k): k in [0..n]]): n in [0..20]]; // _G. C. Greubel_, Jan 12 2022
%o (Sage) [sum(factorial(k)*n^(n-k) for k in (0..n)) for n in (0..20)] # _G. C. Greubel_, Jan 12 2022
%Y Cf. A000142.
%K nonn
%O 0,2
%A _Roger Cuculière_, Dec 17 2005
%E Corrected and extended by _Robert G. Wilson v_, Dec 22 2005