login
a(n) = floor( n! / e ).
2

%I #38 Dec 15 2022 08:31:02

%S 0,0,2,8,44,264,1854,14832,133496,1334960,14684570,176214840,

%T 2290792932,32071101048,481066515734,7697064251744,130850092279664,

%U 2355301661033952,44750731559645106,895014631192902120

%N a(n) = floor( n! / e ).

%H Paolo P. Lava, <a href="/A014508/b014508.txt">Table of n, a(n) for n = 1..100</a>

%H Michael Penn, <a href="https://www.youtube.com/watch?v=wrHxeHJDTk4">Always even.</a>, YouTube video, 2022.

%H R. Sedgewick, <a href="http://homepage.math.uiowa.edu/~goodman/22m150.dir/2007/Permutation%20Generation%20Methods.pdf">Permutation generation methods</a>, Computing Surveys, 9 (1977), 137-164.

%F a(n) = Sum_{k=0..n-1} (n - k - 1)*A000166(n - k - 1). - _Robert G. Wilson v_, Apr 01 2011

%F a(n) = A000166(n) - (n mod 2). - _Joerg Arndt_, Apr 02 2011

%F E.g.f.: -exp(x)/2-(x+1)*exp(-x)/(2*x-2). - _Mark van Hoeij_, Oct 30 2011

%t f[n_] := Floor[n!/E]; Array[f, 20] (* or *) a[0] = 1; a[n_] := a[n] = n*a[n - 1] + (-1)^n; f[n_] := Sum[(n - k - 1) a[n - k - 1], {k, 0, n - 1}]; Array[f, 20] (* _Robert G. Wilson v_, Apr 01 2011 *)

%o (PARI) vector(30, n, if(n,round(n!/exp(1)), 1)-(n+1)%2) \\ _Altug Alkan_, Nov 04 2015

%Y Cf. A000166.

%K nonn,easy

%O 1,3

%A _Simon Plouffe_

%E Sedgewick reference from _N. J. A. Sloane_, Mar 07 2008