A105478 Triangle read by rows: T(n,k) is the number of compositions of n into k parts when parts 1 and 2 are of two kinds.
2, 2, 4, 1, 8, 8, 1, 8, 24, 16, 1, 8, 36, 64, 32, 1, 9, 44, 128, 160, 64, 1, 10, 54, 192, 400, 384, 128, 1, 11, 66, 264, 720, 1152, 896, 256, 1, 12, 79, 352, 1120, 2432, 3136, 2048, 512, 1, 13, 93, 456, 1632, 4272, 7616, 8192, 4608, 1024, 1, 14, 108, 576, 2280, 6816
Offset: 1
Examples
T(4,2)=8 because we have (1,3),(1',3),(3,1),(3,1'),(2,2),(2,2'),(2',2) and (2',2'). Triangle begins: 2; 2,4; 1,8,8; 1,8,24,16; 1,8,36,64,32;
Crossrefs
Row sums yield A052536.
Programs
-
Maple
G:=t*z*(2-z^2)/(1-z-2*t*z+t*z^3): Gser:=simplify(series(G,z=0,14)): for n from 1 to 12 do P[n]:=expand(coeff(Gser,z^n)) od: for n from 1 to 12 do seq(coeff(P[n],t^k),k=1..n) od; # yields sequence in triangular form
-
Mathematica
t[1, 1] = t[2, 1] = 2; t[3, 2] = 8; t[, 1] = 1; t[n, n_] := 2^n; t[n_, k_] /; 1 <= k <= n := t[n, k] = t[n-1, k] + 2*t[n-1, k-1] - t[n-3, k-1]; t[n_, k_] = 0; Table[t[n, k], {n, 1, 11}, {k, 1, n}] // Flatten (* Jean-François Alcover, Jun 12 2013 *)
Formula
G.f.=tz(2-z^2)/(1-z-2tz+tz^3). T(n, k)=T(n-1, k)+2T(n-1, k-1)-T(n-3, k-1).