login
Triangle read by rows: T(n,k) is the number of compositions into nonzero parts with k parts directly followed by a different part, n>=0, 0<=k<=n.
100

%I #16 Jan 12 2015 04:12:38

%S 1,1,0,2,0,0,2,2,0,0,3,4,1,0,0,2,10,4,0,0,0,4,12,14,2,0,0,0,2,22,29,

%T 10,1,0,0,0,4,26,56,36,6,0,0,0,0,3,34,100,86,31,2,0,0,0,0,4,44,148,

%U 200,99,16,1,0,0,0,0,2,54,230,374,278,78,8,0,0,0,0,0,6,58,322,680,654,274,52,2,0,0,0,0,0

%N Triangle read by rows: T(n,k) is the number of compositions into nonzero parts with k parts directly followed by a different part, n>=0, 0<=k<=n.

%C First column (k=0) is A000005, second column (k=1) is 2*A002133.

%C Row sums are A011782.

%H Joerg Arndt and Alois P. Heinz, <a href="/A238130/b238130.txt">Rows n = 0..140, flattened</a>

%e Triangle starts:

%e 00: 1,

%e 01: 1, 0,

%e 02: 2, 0, 0,

%e 03: 2, 2, 0, 0,

%e 04: 3, 4, 1, 0, 0,

%e 05: 2, 10, 4, 0, 0, 0,

%e 06: 4, 12, 14, 2, 0, 0, 0,

%e 07: 2, 22, 29, 10, 1, 0, 0, 0,

%e 08: 4, 26, 56, 36, 6, 0, 0, 0, 0,

%e 09: 3, 34, 100, 86, 31, 2, 0, 0, 0, 0,

%e 10: 4, 44, 148, 200, 99, 16, 1, 0, 0, 0, 0,

%e 11: 2, 54, 230, 374, 278, 78, 8, 0, 0, 0, 0, 0,

%e 12: 6, 58, 322, 680, 654, 274, 52, 2, 0, 0, 0, 0, 0,

%e 13: 2, 74, 446, 1122, 1390, 814, 225, 22, 1, 0, 0, 0, 0, 0,

%e ...

%e Row 5 is [2, 10, 4, 0, 0, 0] 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-> seq(coeff(b(n, 0), x, i), i=0..n):

%p seq(T(n), n=0..14);

%t b[n_, v_] := b[n, v] = If[n == 0, 1, Sum[b[n-i, i]*If[v == 0 || v == i, 1, x], {i, 1, n}]]; T[n_] := Table[Coefficient[b[n, 0], x, i], {i, 0, n}]; Table[T[n], {n, 0, 14}] // Flatten (* _Jean-François Alcover_, Jan 12 2015, translated from Maple *)

%Y Cf. A238279 (same sequence with zeros omitted).

%Y Cf. A106356 (compositions with k successive parts same).

%Y Cf. A225084 (compositions with maximal up-step k).

%K nonn,tabl

%O 0,4

%A _Joerg Arndt_ and _Alois P. Heinz_, Feb 21 2014