A242498 Number T(n,k) of compositions of n, where k is the difference between the number of odd parts and the number of even parts; triangle T(n,k), n>=0, -floor(n/2)+(n mod 2)<=k<=n, read by rows.
1, 1, 1, 0, 0, 1, 2, 1, 0, 1, 1, 1, 0, 3, 2, 0, 1, 3, 4, 1, 4, 3, 0, 1, 1, 2, 1, 6, 9, 3, 5, 4, 0, 1, 4, 9, 6, 11, 16, 6, 6, 5, 0, 1, 1, 3, 3, 11, 24, 18, 19, 25, 10, 7, 6, 0, 1, 5, 16, 18, 28, 51, 40, 31, 36, 15, 8, 7, 0, 1, 1, 4, 6, 19, 51, 60, 65, 95, 75, 48, 49, 21, 9, 8, 0, 1
Offset: 0
Examples
Triangle T(n,k) begins: : n\k : -5 -4 -3 -2 -1 0 1 2 3 4 5 6 7 8 9 10 ... +-----+--------------------------------------------------------- : 0 : 1; : 1 : 1; : 2 : 1, 0, 0, 1; : 3 : 2, 1, 0, 1; : 4 : 1, 1, 0, 3, 2, 0, 1; : 5 : 3, 4, 1, 4, 3, 0, 1; : 6 : 1, 2, 1, 6, 9, 3, 5, 4, 0, 1; : 7 : 4, 9, 6, 11, 16, 6, 6, 5, 0, 1; : 8 : 1, 3, 3, 11, 24, 18, 19, 25, 10, 7, 6, 0, 1; : 9 : 5, 16, 18, 28, 51, 40, 31, 36, 15, 8, 7, 0, 1; : 10 : 1, 4, 6, 19, 51, 60, 65, 95, 75, 48, 49, 21, 9, 8, 0, 1;
Links
- Alois P. Heinz, Rows n = 0..120, flattened
Crossrefs
Programs
-
Maple
b:= proc(n, i, p) option remember; `if`(n=0, p!, `if`(i<1, 0, expand( add(x^(j*(2*irem(i, 2)-1))*b(n-i*j, i-1, p+j)/j!, j=0..n/i)))) end: T:= n-> (p-> seq(coeff(p, x, i), i=ldegree(p)..degree(p)))(b(n$2, 0)): seq(T(n), n=0..20);
-
Mathematica
b[n_, i_, p_] := b[n, i, p] = If[n == 0, p!, If[i<1, 0, Expand[Sum[x^(j*(2*Mod[i, 2]-1))*b[n-i*j, i-1, p+j]/j!, {j, 0, n/i}]]]] ; T[n_] := Function[{p}, Table[ Coefficient[p, x, i], {i, Exponent[p, x, Min], Exponent[p, x]}]][b[n, n, 0]]; Table[T[n], {n, 0, 20}] // Flatten (* Jean-François Alcover, Feb 11 2015, after Alois P. Heinz *)
Comments