OFFSET
1,3
COMMENTS
a(n) = Sum_{k=0..ceiling(n/2)} k*A152662(n,k).
FORMULA
a(2n+1) = (2n+1)!;
a(2n) = n(2n)!/(n+1).
D-finite with recurrence 2*(n+2)*a(n) +3*(-n-1)*a(n-1) -2*n*(n-1)*(n+1)*a(n-2) +(n-2)*(n-1)^2*a(n-3)=0. - R. J. Mathar, Jul 26 2022
EXAMPLE
a(3) = 6 because in the permutations 123, 132, 213, 231, 312, 321 we have 1+2+0+0+2+1 = 6 leading odd entries.
MAPLE
ao := proc (n) options operator, arrow; factorial(2*n+1) end proc: ae := proc (n) options operator, arrow: n*factorial(2*n)/(n+1) end proc: a := proc (n) if `mod`(n, 2) = 1 then ao((1/2)*n-1/2) else ae((1/2)*n) end if end proc: seq(a(n), n = 1 .. 20);
MATHEMATICA
a[n_] := If[OddQ[n], n!, n*n!/(n+2)];
Table[a[n], {n, 1, 20}] (* Jean-François Alcover, Apr 02 2024 *)
CROSSREFS
KEYWORD
nonn
AUTHOR
Emeric Deutsch, Dec 13 2008
STATUS
approved