OFFSET
0,3
COMMENTS
Number of permutations p of [n] such that p(i) < p(i+3) > p(i+6) < ... for i <= 3.
LINKS
Alois P. Heinz, Table of n, a(n) for n = 0..485
EXAMPLE
a(4) = 12: 1234, 1243, 1324, 1342, 1423, 1432, 2134, 2143, 2314, 2413, 3124, 3214.
a(5) = 30: 12345, 12354, 12435, 12453, 12534, 12543, 13245, 13254, 13425, 13524, 14235, 14325, 21345, 21354, 21435, 21453, 21534, 21543, 23145, 23154, 24135, 31245, 31254, 31452, 31542, 32145, 32154, 41253, 41352, 42153.
MAPLE
b:= proc(u, o) option remember;
`if`(u+o=0, 1, add(b(o-1+j, u-j), j=1..u))
end:
a:= n-> (l-> combinat[multinomial](n, l[])*mul(
b(s, 0), s=l))([floor((n+i)/3)$i=0..2]):
seq(a(n), n=0..27);
MATHEMATICA
multinomial[n_, k_List] := n!/Times @@ (k!);
b[u_, o_] := b[u, o] = If[u+o == 0, 1, Sum[b[o-1+j, u-j], {j, 1, u}]];
a[n_] := Function[l, Product[b[s, 0], {s, l}]*multinomial[n, l]][Table[ Floor[(n+i)/3], {i, 0, 2}]];
Table[a[n], {n, 0, 27}] (* Jean-François Alcover, Nov 27 2023, after Alois P. Heinz *)
CROSSREFS
KEYWORD
nonn
AUTHOR
Alois P. Heinz, Nov 14 2023
STATUS
approved