OFFSET
2,1
COMMENTS
a(n) = Sum(k*A152667(n,k), k=1..floor(n/2)).
FORMULA
a(2n) = (n+1)(2n)!/2;
a(2n+1) = n(n+2)(2n)!.
D-finite with recurrence a(n) -2*a(n-1) -n*(n-1)*a(n-2) +2*(n-3)*(n-4)*a(n-4)=0. - R. J. Mathar, Jul 24 2022
EXAMPLE
a(3) = 6 because each of the permutations 123, 132, 213, 231, 312, 321 has exactly 1 run of even entries.
MAPLE
ae := proc (n) options operator, arrow: (1/2)*factorial(2*n)*(n+1) end proc: ao := proc (n) options operator, arrow: n*(n+2)*factorial(2*n) end proc: a := proc (n) if `mod`(n, 2) = 0 then ae((1/2)*n) else ao((1/2)*n-1/2) end if end proc; seq(a(n), n = 2 .. 20);
MATHEMATICA
a[n_] := If[EvenQ[n], (n/2+1)n!/2, ((n-1)/2)((n-1)/2+2)(n-1)!];
Table[a[n], {n, 2, 20}] (* Jean-François Alcover, Apr 09 2024 *)
CROSSREFS
KEYWORD
nonn
AUTHOR
Emeric Deutsch, Dec 14 2008
STATUS
approved