%I #11 Feb 08 2017 11:41:02
%S 1,1,2,3,1,7,0,1,13,2,0,1,24,5,2,0,1,46,11,4,2,0,1,89,21,11,4,2,0,1,
%T 170,45,23,11,4,2,0,1,324,99,47,23,12,4,2,0,1,618,209,102,52,23,13,4,
%U 2,0,1,1183,427,226,112,55,24,14,4,2,0,1,2260,883,479
%N Number T(n,k) of compositions of n with exactly k (possibly overlapping) occurrences of the consecutive pattern 111; triangle T(n,k), n>=0, 0<=k<=max(0,n-2), read by rows.
%H Alois P. Heinz, <a href="/A232435/b232435.txt">Rows n = 0..150, flattened</a>
%e T(4,0) = 7: [4], [3,1], [2,2], [1,3], [2,1,1], [1,2,1], [1,1,2].
%e T(7,1) = 11: [4,1,1,1], [2,2,2,1], [1,2,2,2], [1,1,1,4], [1,3,1,1,1], [2,2,1,1,1], [1,1,1,3,1], [2,1,1,1,2], [1,1,1,2,2], [1,1,1,2,1,1], [1,1,2,1,1,1].
%e T(7,2) = 4: [3,1,1,1,1], [1,1,1,1,3], [1,2,1,1,1,1], [1,1,1,1,2,1].
%e T(7,3) = 2: [2,1,1,1,1,1], [1,1,1,1,1,2].
%e T(7,5) = 1: [1,1,1,1,1,1,1].
%e Triangle T(n,k) begins:
%e : 0 : 1;
%e : 1 : 1;
%e : 2 : 2;
%e : 3 : 3, 1;
%e : 4 : 7, 0, 1;
%e : 5 : 13, 2, 0, 1;
%e : 6 : 24, 5, 2, 0, 1;
%e : 7 : 46, 11, 4, 2, 0, 1;
%e : 8 : 89, 21, 11, 4, 2, 0, 1;
%e : 9 : 170, 45, 23, 11, 4, 2, 0, 1;
%e : 10 : 324, 99, 47, 23, 12, 4, 2, 0, 1;
%p b:= proc(n, t) option remember; `if`(n=0, 1,
%p expand(add(`if`(abs(t)<>j, b(n-j, j),
%p `if`(t<0, x, 1)*b(n-j, -j)), j=1..n)))
%p end:
%p T:= n->(p->seq(coeff(p, x, i), i=0..degree(p)))(b(n, 0)):
%p seq(T(n), n=0..15);
%t b[n_, t_] := b[n, t] = If[n==0, 1, Expand[Sum[If[Abs[t] != j, b[n-j, j], If[t<0, x, 1]*b[n-j, -j]], {j, 1, n}]]]; T[n_] := Function[p, Table[ Coefficient[p, x, i], {i, 0, Exponent[p, x]}]][b[n, 0]]; Table[T[n], {n, 0, 15}] // Flatten (* _Jean-François Alcover_, Feb 08 2017, translated from Maple *)
%Y Column k=0 gives: A128695.
%Y Row sums give: A011782.
%K nonn,tabf
%O 0,3
%A _Alois P. Heinz_, Nov 23 2013
|