login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

A229066
Number of 1 up, 2 down, 3 up, 4 down, ... permutations of [n].
4
1, 1, 1, 2, 3, 11, 26, 50, 315, 1168, 3309, 7910, 78134, 431354, 1748956, 5797168, 16619603, 239887424, 1875375485, 10496708022, 47013492080, 178807998112, 599025922320, 11965846097382, 126883998286089, 947079890934441, 5574231845278396, 27500583638094490
OFFSET
0,4
LINKS
EXAMPLE
a(2) = 1: 12.
a(3) = 2: 132, 231.
a(4) = 3: 1432, 2431, 3421.
a(5) = 11: 14325, 15324, 15423, 24315, 25314, 25413, 34215, 35214, 35412, 45213, 45312.
a(6) = 26: 143256, 153246, ..., 563124, 564123.
a(7) = 50: 1432567, 1532467, ..., 6741235, 6751234.
a(8) = 315: 14325687, 14325786, ..., 78613452, 78623451.
MAPLE
b:= proc(u, o, t, k) option remember; `if`(u+o=0, 1, add(`if`(t=k,
b(o-j, u+j-1, 1, k+1), b(u+j-1, o-j, t+1, k)), j=1..o))
end:
a:= n-> b(0, n, 0, 1):
seq(a(n), n=0..35);
MATHEMATICA
b[u_, o_, t_, k_] := b[u, o, t, k] = If[u + o == 0, 1, Sum[If[t == k, b[o - j, u + j - 1, 1, k + 1], b[u + j - 1, o - j, t + 1, k]], {j, 1, o}]];
a[n_] := b[0, n, 0, 1];
a /@ Range[0, 35] (* Jean-François Alcover, Mar 22 2021, after Alois P. Heinz *)
CROSSREFS
KEYWORD
nonn,eigen
AUTHOR
Alois P. Heinz, Oct 02 2013
STATUS
approved