login
Number of permutations p of [n] such that p(i), p(i+3), p(i+6),... form an up-down sequence for i in {1,2,3}.
2

%I #18 Dec 06 2023 14:44:40

%S 1,1,2,6,12,30,90,420,2240,13440,84000,577500,4331250,36036000,

%T 322882560,3099672576,31513337856,340409701632,3893435962416,

%U 47122428697344,600341948743680,8030803773358080,112453396587417600,1646232972560748000,25147419121286426250

%N Number of permutations p of [n] such that p(i), p(i+3), p(i+6),... form an up-down sequence for i in {1,2,3}.

%C Number of permutations p of [n] such that p(i) < p(i+3) > p(i+6) < ... for i <= 3.

%H Alois P. Heinz, <a href="/A367336/b367336.txt">Table of n, a(n) for n = 0..485</a>

%e a(4) = 12: 1234, 1243, 1324, 1342, 1423, 1432, 2134, 2143, 2314, 2413, 3124, 3214.

%e 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.

%p b:= proc(u, o) option remember;

%p `if`(u+o=0, 1, add(b(o-1+j, u-j), j=1..u))

%p end:

%p a:= n-> (l-> combinat[multinomial](n, l[])*mul(

%p b(s, 0), s=l))([floor((n+i)/3)$i=0..2]):

%p seq(a(n), n=0..27);

%t multinomial[n_, k_List] := n!/Times @@ (k!);

%t b[u_, o_] := b[u, o] = If[u+o == 0, 1, Sum[b[o-1+j, u-j], {j, 1, u}]];

%t a[n_] := Function[l, Product[b[s, 0], {s, l}]*multinomial[n, l]][Table[ Floor[(n+i)/3], {i, 0, 2}]];

%t Table[a[n], {n, 0, 27}] (* _Jean-François Alcover_, Nov 27 2023, after _Alois P. Heinz_ *)

%Y Column k=3 of A361651.

%Y Cf. A000111, A000142, A022916.

%K nonn

%O 0,3

%A _Alois P. Heinz_, Nov 14 2023