%I #41 Jul 17 2024 07:48:32
%S 1,1,2,2,2,3,4,1,2,10,4,4,12,14,2,2,22,29,10,1,4,26,56,36,6,3,34,100,
%T 86,31,2,4,44,148,200,99,16,1,2,54,230,374,278,78,8,6,58,322,680,654,
%U 274,52,2,2,74,446,1122,1390,814,225,22,1,4,88,573,1796,2714,2058,813,136,10,4,88,778,2694,4927
%N Triangle read by rows: T(n,k) is the number of compositions of n into nonzero parts with k parts directly followed by a different part, n>=0, 0<=k<=A004523(n-1).
%C Same as A238130, with zeros omitted.
%C Last elements in rows are 1, 1, 2, 2, 1, 4, 2, 1, 6, 2, 1, 8, ... with g.f. -(x^6+x^4-2*x^2-x-1)/(x^6-2*x^3+1).
%C For n > 0, also the number of compositions of n with k + 1 runs. - _Gus Wiseman_, Apr 10 2020
%H Joerg Arndt and Alois P. Heinz, <a href="/A238279/b238279.txt">Rows n = 0..180, flattened</a>
%F G.f.: A(x,y) = ( 1 + Sum_{i>0} ((x^i)*(1 - y)/(1 + y*x^i - x^i)) )/( 1 - Sum_{i>0} ((y*x^i)/(1 + y*x^i - x^i)) ). - _John Tyler Rascoe_, Jul 10 2024
%e Triangle starts:
%e 00: 1;
%e 01: 1;
%e 02: 2;
%e 03: 2, 2;
%e 04: 3, 4, 1;
%e 05: 2, 10, 4;
%e 06: 4, 12, 14, 2;
%e 07: 2, 22, 29, 10, 1;
%e 08: 4, 26, 56, 36, 6;
%e 09: 3, 34, 100, 86, 31, 2;
%e 10: 4, 44, 148, 200, 99, 16, 1;
%e 11: 2, 54, 230, 374, 278, 78, 8;
%e 12: 6, 58, 322, 680, 654, 274, 52, 2;
%e 13: 2, 74, 446, 1122, 1390, 814, 225, 22, 1;
%e 14: 4, 88, 573, 1796, 2714, 2058, 813, 136, 10;
%e 15: 4, 88, 778, 2694, 4927, 4752, 2444, 618, 77, 2;
%e 16: 5, 110, 953, 3954, 8531, 9930, 6563, 2278, 415, 28, 1;
%e ...
%e Row n=5 is 2, 10, 4 because in the 16 compositions of 5
%e ##: [composition] no. of changes
%e 01: [ 1 1 1 1 1 ] 0
%e 02: [ 1 1 1 2 ] 1
%e 03: [ 1 1 2 1 ] 2
%e 04: [ 1 1 3 ] 1
%e 05: [ 1 2 1 1 ] 2
%e 06: [ 1 2 2 ] 1
%e 07: [ 1 3 1 ] 2
%e 08: [ 1 4 ] 1
%e 09: [ 2 1 1 1 ] 1
%e 10: [ 2 1 2 ] 2
%e 11: [ 2 2 1 ] 1
%e 12: [ 2 3 ] 1
%e 13: [ 3 1 1 ] 1
%e 14: [ 3 2 ] 1
%e 15: [ 4 1 ] 1
%e 16: [ 5 ] 0
%e there are 2 with no changes, 10 with one change, and 4 with two changes.
%p b:= proc(n, v) option remember; `if`(n=0, 1, expand(
%p add(b(n-i, i)*`if`(v=0 or v=i, 1, x), i=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..14);
%t b[n_, v_] := b[n, v] = If[n == 0, 1, Expand[Sum[b[n-i, i]*If[v == 0 || v == i, 1, x], {i, 1, n}]]]; T[n_] := Function[{p}, Table[Coefficient[p, x, i], {i, 0, Exponent[p, x]}]][b[n, 0]]; Table[T[n], {n, 0, 14}] // Flatten (* _Jean-François Alcover_, Feb 11 2015, after Maple *)
%t Table[If[n==0,1,Length[Select[Join@@Permutations/@IntegerPartitions[n],Length[Split[#]]==k+1&]]],{n,0,12},{k,0,If[n==0,0,Floor[2*(n-1)/3]]}] (* _Gus Wiseman_, Apr 10 2020 *)
%o (PARI)
%o T_xy(max_row) = {my(N=max_row+1, x='x+O('x^N),h=(1+ sum(i=1,N,(x^i-y*x^i)/(1+y*x^i-x^i)))/(1-sum(i=1,N, y*x^i/(1+y*x^i-x^i)))); for(n=0,N-1, print(Vecrev(polcoeff(h,n))))}
%o T_xy(16) \\ _John Tyler Rascoe_, Jul 10 2024
%Y Columns k=0-10 give: A000005 (for n>0), 2*A002133, A244714, A244715, A244716, A244717, A244718, A244719, A244720, A244721, A244722.
%Y Row lengths are A004523.
%Y Row sums are A011782.
%Y The version counting adjacent equal parts is A106356.
%Y The version for ascents/descents is A238343.
%Y The version for weak ascents/descents is A333213.
%Y The k-th composition in standard-order has A124762(k) adjacent equal parts, A124767(k) maximal runs, A333382(k) adjacent unequal parts, and A333381(k) maximal anti-runs.
%Y Cf. A064113, A333214, A333216.
%K nonn,tabf
%O 0,3
%A _Joerg Arndt_ and _Alois P. Heinz_, Feb 22 2014