OFFSET
0,3
COMMENTS
An up-jump j occurs at position i in p if p_{i} > p_{i-1} and j is the index of p_i in the increasingly sorted list of those elements in {p_{i}, ..., p_{n}} that are larger than p_{i-1}. A down-jump -j occurs at position i in p if p_{i} < p_{i-1} and j is the index of p_i in the decreasingly sorted list of those elements in {p_{i}, ..., p_{n}} that are smaller than p_{i-1}. First index in the lists is 1 here.
LINKS
Alois P. Heinz, Table of n, a(n) for n = 0..40
MAPLE
b:= proc(u, o, c, k) option remember;
`if`(c>k, 0, `if`(u+o=0, 1,
add(b(u-j, o-1+j, c+j, k), j=1..u)+
add(b(u+j-1, o-j, c-j, k), j=1..o)))
end:
a:= n-> add(b(k, 0$2, n)-b(k, 0$2, n-1), k=n..n*(n+1)/2):
seq(a(n), n=0..15);
MATHEMATICA
b[u_, o_, c_, k_] := b[u, o, c, k] =
If[c > k, 0, If[u + o == 0, 1,
Sum[b[u - j, o - 1 + j, c + j, k], {j, u}] +
Sum[b[u + j - 1, o - j, c - j, k], {j, o}]]];
a[n_] := Sum[b[k, 0, 0, n] - b[k, 0, 0, n-1], {k, n, n(n+1)/2}];
Table[a[n], {n, 0, 15}] (* Jean-François Alcover, Sep 01 2021, after Alois P. Heinz *)
CROSSREFS
KEYWORD
nonn
AUTHOR
Alois P. Heinz, Jun 28 2018
STATUS
approved