OFFSET
0,4
LINKS
Alois P. Heinz, Table of n, a(n) for n = 0..450
FORMULA
a(n) = Sum_{j=0..floor(n/2)} d(n-j)*binomial(floor(n/2), j), where d(i)=A000166(i) are the derangement numbers.
a(n) = Sum_{j=0..ceiling(n/2)} (-1)^j*binomial(ceiling(n/2), j)*(n-j)!. - Emeric Deutsch, Jul 18 2009
a(n) ~ exp(-1/2) * n!. - Vaclav Kotesovec, Feb 18 2017
From Peter Luschny, Jul 15 2022: (Start)
a(n) = n!*hypergeom([-ceiling(n/2)], [-n], -1).
a(n) = A068106(n, floor(n/2)). (End)
D-finite with recurrence +16*a(n) -24*a(n-1) -4*(2*n-1)*(2*n-3)*a(n-2) +4*(2*n^2-10*n+15)*a(n-3) +2*(-10*n+29)*a(n-4) +2*(n-2)*(n-4)*a(n-5) +(n-4)*(n-5)*a(n-6)=0. - R. J. Mathar, Jul 26 2022
EXAMPLE
a(3)=3 because we have 312, 231, and 321.
MAPLE
d[0] := 1: for n to 25 do d[n] := n*d[n-1]+(-1)^n end do: a := proc (n) options operator, arrow: add(d[n-j]*binomial(floor((1/2)*n), j), j = 0 .. floor((1/2)*n)) end proc; seq(a(n), n = 0 .. 22);
a := proc (n) options operator, arrow: add((-1)^j*binomial(ceil((1/2)*n), j)*factorial(n-j), j = 0 .. ceil((1/2)*n)) end proc; seq(a(n), n = 0 .. 22); # Emeric Deutsch, Jul 18 2009
# next Maple program:
a:= proc(n) option remember; `if`(n<4, [1, 0, 1, 3][n+1],
(8*(n-1)*(2*n-5)*a(n-1)+2*(8*n^4-48*n^3+102*n^2-90*n+29)*a(n-2)
-2*(2*n-1)*(n-2)*a(n-3)+(2*n-1)*(2*n-3)*(n-2)*(n-3)*a(n-4))
/(4*(2*n-3)*(2*n-5)))
end:
seq(a(n), n=0..30); # Alois P. Heinz, Jul 15 2022
a := n -> n!*hypergeom([-ceil(n/2)], [-n], -1):
seq(simplify(a(n)), n = 0..22); # Peter Luschny, Jul 15 2022
MATHEMATICA
Table[Sum[(-1)^j*Binomial[Ceiling[n/2], j]*(n-j)!, {j, 0, Ceiling[n/2]}], {n, 0, 30}] (* Vaclav Kotesovec, Feb 18 2017 *)
PROG
(PARI) for(n=0, 30, print1(sum(j=0, ceil(n/2), (-1)^j*binomial(ceil(n/2), j)*(n - j)!), ", ")) \\ Indranil Ghosh, Mar 08 2017
CROSSREFS
KEYWORD
nonn
AUTHOR
Emeric Deutsch, Jul 18 2009
STATUS
approved