A242820 Number T(n,k) of permutations of [n] with exactly k occurrences of the consecutive step pattern up, down, down, down; triangle T(n,k), n>=0, 0<=k<=max(0,floor((n-1)/4)), read by rows.
1, 1, 2, 6, 24, 116, 4, 672, 48, 4536, 504, 34944, 5376, 302896, 59488, 496, 2916992, 697856, 13952, 30899616, 8720448, 296736, 357080064, 116109312, 5812224, 4470310976, 1645662912, 110697408, 349504, 60269056512, 24776769024, 2114735616, 17730048
Offset: 0
Examples
T(5,1) = 4: (1,5,4,3,2), (2,5,4,3,1), (3,5,4,2,1), (4,5,3,2,1). Triangle T(n,k) begins: : 0 : 1; : 1 : 1; : 2 : 2; : 3 : 6; : 4 : 24; : 5 : 116, 4; : 6 : 672, 48; : 7 : 4536, 504; : 8 : 34944, 5376; : 9 : 302896, 59488, 496; : 10 : 2916992, 697856, 13952; : 11 : 30899616, 8720448, 296736;
Links
- Alois P. Heinz, Rows n = 0..140, flattened
Programs
-
Maple
b:= proc(u, o, t) option remember; `if`(u+o=0, 1, expand( add(b(u-j, o+j-1, [1, 3, 4, 1][t])*`if`(t=4, x, 1), j=1..u)+ add(b(u+j-1, o-j, 2), j=1..o))) end: T:= n-> (p-> seq(coeff(p, x, i), i=0..degree(p)))(b(n, 0, 1)): seq(T(n), n=0..15);
-
Mathematica
b[u_, o_, t_] := b[u, o, t] = If[u + o == 0, 1, Expand[ Sum[b[u - j, o + j - 1, {1, 3, 4, 1}[[t]]]*If[t==4, x, 1], {j, 1, u}]+ Sum[b[u + j - 1, o - j, 2], {j, 1, o}]]]; T[n_] := CoefficientList[b[n, 0, 1], x]; T /@ Range[0, 15] // Flatten (* Jean-François Alcover, Mar 23 2021, after Alois P. Heinz *)