OFFSET
0,4
COMMENTS
The up-down signature has (+1) for each ascent and (-1) for each descent.
LINKS
Alois P. Heinz, Table of n, a(n) for n = 0..450
MAPLE
b:= proc(u, o, t) option remember; (n->
`if`(t>=n, n!, `if`(t<-n, 0,
add(b(u-j, o+j-1, t-1), j=1..u)+
add(b(u+j-1, o-j, t+1), j=1..o))))(u+o)
end:
a:= n-> `if`(n=0, 1, add(b(j-1, n-j, 0), j=1..n)):
seq(a(n), n=0..25);
# second Maple program:
a:= n-> `if`(irem(n, 2, 'r')=0, ceil(n!/2),
add(combinat[eulerian1](n, j), j=0..r)):
seq(a(n), n=0..25);
MATHEMATICA
Eulerian1[n_, k_] := If[k == 0, 1, If[n == 0, 0, Sum[(-1)^j (k - j + 1)^n Binomial[n + 1, j], {j, 0, k + 1}]]];
a[n_] := Module[{r, m}, {r, m} = QuotientRemainder[n, 2]; If[m == 0, Ceiling[n!/2], Sum[Eulerian1[n, j], {j, 0, r}]]];
a /@ Range[0, 25] (* Jean-François Alcover, Mar 26 2021, after 2nd Maple program *)
CROSSREFS
KEYWORD
nonn
AUTHOR
Alois P. Heinz, May 04 2018
STATUS
approved