%I #22 Apr 28 2022 20:18:30
%S 1,1,1,3,0,1,4,3,0,1,7,6,2,0,1,14,7,8,2,0,1,23,20,10,8,2,0,1,39,42,22,
%T 13,9,2,0,1,71,72,58,28,14,10,2,0,1,124,141,112,72,33,16,11,2,0,1,214,
%U 280,219,150,92,36,18,12,2,0,1,378,516,466,311,189,112,40,20,13,2,0,1
%N Triangle T(n,k) 0<=k<n : Number of compositions of n with k adjacent equal parts.
%C For n > 0, also the number of compositions of n with k + 1 maximal anti-runs (sequences without adjacent equal terms). - _Gus Wiseman_, Mar 23 2020
%H Alois P. Heinz, <a href="/A106356/b106356.txt">Rows n = 1..141, flattened</a>
%H A. Knopfmacher and H. Prodinger, <a href="http://dx.doi.org/10.1006/eujc.1998.0216">On Carlitz compositions</a>, European Journal of Combinatorics, Vol. 19, 1998, pp. 579-589.
%e T(4,1) = 3 because the compositions of 4 with 1 adjacent equal part are 1+1+2, 2+1+1, 2+2.
%e Triangle begins:
%e 1;
%e 1, 1;
%e 3, 0, 1;
%e 4, 3, 0, 1;
%e 7, 6, 2, 0, 1;
%e 14, 7, 8, 2, 0, 1;
%e 23, 20, 10, 8, 2, 0, 1;
%e From _Gus Wiseman_, Mar 23 2020 (Start)
%e Row n = 6 counts the following compositions (empty column shown by dot):
%e (6) (33) (222) (11112) . (111111)
%e (15) (114) (1113) (21111)
%e (24) (411) (1122)
%e (42) (1131) (2211)
%e (51) (1221) (3111)
%e (123) (1311) (11121)
%e (132) (2112) (11211)
%e (141) (12111)
%e (213)
%e (231)
%e (312)
%e (321)
%e (1212)
%e (2121)
%e (End)
%p b:= proc(n, h, t) option remember;
%p if n=0 then `if`(t=0, 1, 0)
%p elif t<0 then 0
%p else add(b(n-j, j, `if`(j=h, t-1, t)), j=1..n)
%p fi
%p end:
%p T:= (n, k)-> b(n, -1, k):
%p seq(seq(T(n, k), k=0..n-1), n=1..15); # _Alois P. Heinz_, Oct 23 2011
%t b[n_, h_, t_] := b[n, h, t] = If[n == 0, If[t == 0, 1, 0], If[t<0, 0, Sum[b[n-j, j, If [j == h, t-1, t]], {j, 1, n}]]]; T[n_, k_] := b[n, -1, k]; Table[Table[T[n, k], {k, 0, n-1}], {n, 1, 15}] // Flatten (* _Jean-François Alcover_, Feb 20 2015, after _Alois P. Heinz_ *)
%t Table[Length[Select[Join@@Permutations/@IntegerPartitions[n],n==0||Length[Split[#,#1!=#2&]]==k+1&]],{n,0,12},{k,0,n}] (* _Gus Wiseman_, Mar 23 2020 *)
%Y Row sums: 2^(n-1)=A000079(n-1). Columns 0-4: A003242, A106357-A106360.
%Y The version counting adjacent unequal parts is A238279.
%Y The k-th composition in standard-order has A124762(k) adjacent equal parts and A333382(k) adjacent unequal parts.
%Y The k-th composition in standard-order has A124767(k) maximal runs and A333381(k) maximal anti-runs.
%Y The version for ascents/descents is A238343.
%Y The version for weak ascents/descents is A333213.
%Y Cf. A064113, A066099, A233564, A333214, A333216.
%K nonn,tabl
%O 1,4
%A _Christian G. Bower_, Apr 29 2005