OFFSET
0,4
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..500
FORMULA
a(n) = A291684(n,ceiling(n/2)).
MAPLE
b:= proc(u, o, t) option remember; `if`(u+o=0, 1,
add(b(sort([u-j, o+j-1])[], j), j=1..min(t, u))+
add(b(sort([u+j-1, o-j])[], j), j=1..min(t, o)))
end:
a:= n-> `if`(n=0, 1, (j-> b(0, n, j)-b(0, n, j-1))(ceil(n/2))):
seq(a(n), n=0..30);
MATHEMATICA
b[u_, o_, t_] := b[u, o, t] = If[u+o == 0, 1,
Sum[b[Sequence @@ Sort[{u-j, o+j-1}], j], {j, Min[t, u]}]+
Sum[b[Sequence @@ Sort[{u+j-1, o-j}], j], {j, Min[t, o]}]];
a[n_] := If[n == 0, 1,
Function[j, b[0, n, j] - b[0, n, j-1]][Ceiling[n/2]]];
Table[a[n], {n, 0, 30}]; (* Jean-François Alcover, Aug 30 2021, after Alois P. Heinz *)
CROSSREFS
KEYWORD
nonn
AUTHOR
Alois P. Heinz, Apr 19 2018
STATUS
approved