OFFSET
0,3
COMMENTS
The up-down runs of a permutation p are the alternating runs of the permutation p endowed with a 0 in the front. For example, 75814632 has 6 up-down runs: 07, 75, 58, 81, 146, and 632.
FORMULA
a(n) = Sum_{k=1..n} k*A186370(n,k).
a(n) = n!*(4n+1)/6 for n>=2.
E.g.f.: g(z) = z(6-3z+z^2)/[6(1-z)^2].
D-finite with recurrence 4*a(n) +(-4*n-7)*a(n-1) +3*(n-1)*a(n-2)=0. - R. J. Mathar, Jul 22 2022
EXAMPLE
a(3)=13 because the permutations 123, 132, 213, 231, 312, and 321 have a total of 1 + 2 + 3 + 2 + 3 + 2 = 13 up-down runs.
MAPLE
0, 1, seq((1/6)*factorial(n)*(4*n+1), n = 2 .. 20);
MATHEMATICA
Join[{0, 1}, Table[n! (4 n + 1)/6, {n, 2, 20}]] (* Vincenzo Librandi, Sep 11 2015 *)
PROG
(Magma) [0, 1] cat [Factorial(n)*(4*n+1)/6: n in [2..30]]; // Vincenzo Librandi, Sep 11 2015
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Emeric Deutsch and Ira M. Gessel, Mar 01 2011
STATUS
approved