OFFSET
0,3
COMMENTS
Same as A238130, with zeros omitted.
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).
For n > 0, also the number of compositions of n with k + 1 runs. - Gus Wiseman, Apr 10 2020
LINKS
Joerg Arndt and Alois P. Heinz, Rows n = 0..180, flattened
FORMULA
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
EXAMPLE
Triangle starts:
00: 1;
01: 1;
02: 2;
03: 2, 2;
04: 3, 4, 1;
05: 2, 10, 4;
06: 4, 12, 14, 2;
07: 2, 22, 29, 10, 1;
08: 4, 26, 56, 36, 6;
09: 3, 34, 100, 86, 31, 2;
10: 4, 44, 148, 200, 99, 16, 1;
11: 2, 54, 230, 374, 278, 78, 8;
12: 6, 58, 322, 680, 654, 274, 52, 2;
13: 2, 74, 446, 1122, 1390, 814, 225, 22, 1;
14: 4, 88, 573, 1796, 2714, 2058, 813, 136, 10;
15: 4, 88, 778, 2694, 4927, 4752, 2444, 618, 77, 2;
16: 5, 110, 953, 3954, 8531, 9930, 6563, 2278, 415, 28, 1;
...
Row n=5 is 2, 10, 4 because in the 16 compositions of 5
##: [composition] no. of changes
01: [ 1 1 1 1 1 ] 0
02: [ 1 1 1 2 ] 1
03: [ 1 1 2 1 ] 2
04: [ 1 1 3 ] 1
05: [ 1 2 1 1 ] 2
06: [ 1 2 2 ] 1
07: [ 1 3 1 ] 2
08: [ 1 4 ] 1
09: [ 2 1 1 1 ] 1
10: [ 2 1 2 ] 2
11: [ 2 2 1 ] 1
12: [ 2 3 ] 1
13: [ 3 1 1 ] 1
14: [ 3 2 ] 1
15: [ 4 1 ] 1
16: [ 5 ] 0
there are 2 with no changes, 10 with one change, and 4 with two changes.
MAPLE
b:= proc(n, v) option remember; `if`(n=0, 1, expand(
add(b(n-i, i)*`if`(v=0 or v=i, 1, x), i=1..n)))
end:
T:= n-> (p-> seq(coeff(p, x, i), i=0..degree(p)))(b(n, 0)):
seq(T(n), n=0..14);
MATHEMATICA
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 *)
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 *)
PROG
(PARI)
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))))}
T_xy(16) \\ John Tyler Rascoe, Jul 10 2024
CROSSREFS
Columns k=0-10 give: A000005 (for n>0), 2*A002133, A244714, A244715, A244716, A244717, A244718, A244719, A244720, A244721, A244722.
Row lengths are A004523.
Row sums are A011782.
The version counting adjacent equal parts is A106356.
The version for ascents/descents is A238343.
The version for weak ascents/descents is A333213.
KEYWORD
nonn,tabf
AUTHOR
Joerg Arndt and Alois P. Heinz, Feb 22 2014
STATUS
approved