Reminder: The OEIS is hiring a new managing editor, and the application deadline is January 26.
%I #28 May 09 2018 09:56:02
%S 1,1,2,6,23,1,110,10,632,86,2,4229,782,29,32337,7571,407,5,278204,
%T 78726,5856,94,2659223,882997,84351,2215,14,27959880,10657118,1251246,
%U 48234,322,320706444,137977980,19318314,984498,14322,42,3985116699,1910131680,311306106
%N Number T(n,k) of permutations of [n] with exactly k (possibly overlapping) occurrences of the consecutive pattern 1324; triangle T(n,k), n>=0, 0<=k<=max(0,floor(n/2-1)), read by rows.
%C Pattern 4231 gives the same triangle.
%H Alois P. Heinz, <a href="/A264173/b264173.txt">Rows n = 0..120, flattened</a>
%F Sum_{k>0} k * T(n,k) = ceiling((n-3)*n!/4!) = A061206(n-3) (for n>3).
%e T(4,1) = 1: 1324.
%e T(6,2) = 2: 132546, 142536.
%e T(8,3) = 5: 13254768, 13264758, 14253768, 14263758, 15263748.
%e T(10,4) = 14: 132547698(10), 132548697(10), 132647598(10), 132648597(10), 132748596(10), 142537698(10), 142538697(10), 142637598(10), 142638597(10), 142738596(10), 152637498(10), 152638497(10), 152738496(10), 162738495(10).
%e Triangle T(n,k) begins:
%e 00 : 1;
%e 01 : 1;
%e 02 : 2;
%e 03 : 6;
%e 04 : 23, 1;
%e 05 : 110, 10;
%e 06 : 632, 86, 2;
%e 07 : 4229, 782, 29;
%e 08 : 32337, 7571, 407, 5;
%e 09 : 278204, 78726, 5856, 94;
%e 10 : 2659223, 882997, 84351, 2215, 14;
%p b:= proc(u, o, t) option remember; expand(`if`(u+o=0, 1,
%p add(b(u-j, o+j-1, `if`(t>0 and j<t, -j, 0)), j=1..u)+
%p add(b(u+j-1, o-j, j)*`if`(t<0 and -j<=t, x, 1), j=1..o)))
%p end:
%p T:= n-> (p-> seq(coeff(p, x, i), i=0..degree(p)))(b(n, 0$2)):
%p seq(T(n), n=0..14);
%t b[u_, o_, t_] := b[u, o, t] = Expand[If[u + o == 0, 1, Sum[b[u - j, o + j - 1, If[t > 0 && j < t, -j, 0]], {j, 1, u}] + Sum[b[u + j - 1, o - j, j] * If[t < 0 && -j <= t, x, 1], {j, 1, o}]]];
%t T[n_] := Function[p, Table[Coefficient[p, x, i], {i, 0, Exponent[p, x]}]][ b[n, 0, 0]];
%t Table[T[n], {n, 0, 14}] // Flatten (* _Jean-François Alcover_, Apr 30 2017, translated from Maple *)
%Y Columns k=0-10 give: A113228, A264174, A264175, A264176, A264177, A264178, A264179, A264180, A264181, A264182, A264183.
%Y Row sums give A000142.
%Y T(2n+2,n) gives A000108(n) for n>0.
%Y Cf. A004526, A061206, A264319 (pattern 3412).
%K nonn,tabf
%O 0,3
%A _Alois P. Heinz_, Nov 06 2015