login
Triangle read by rows: T(n,k) is the number of ternary words of length n on {0,1,2} having k drops (n>=0, k>=0). The drops of a ternary word on {0,1,2} are the subwords 10,20 and 21.
3

%I #7 May 19 2014 18:06:50

%S 1,3,6,3,10,16,1,15,51,15,21,126,90,6,28,266,357,77,1,36,504,1107,504,

%T 36,45,882,2907,2304,414,9,55,1452,6765,8350,2850,210,1,66,2277,14355,

%U 25653,14355,2277,66,78,3432,28314,69576,58278,16236,1221,12,91,5005

%N Triangle read by rows: T(n,k) is the number of ternary words of length n on {0,1,2} having k drops (n>=0, k>=0). The drops of a ternary word on {0,1,2} are the subwords 10,20 and 21.

%C Row n has 1+floor(2n/3) terms. Row sums are the powers of 3 (A000244). T(n,0)=A000217(n+1) (the triangular numbers). Sum(k*T(n,k),k>=0)=(n-1)*3^(n-1)=A036290(n-1).

%H Alois P. Heinz, <a href="/A120906/b120906.txt">Rows n = 0..200, flattened</a>

%F G.f.: G(t,z) = 1/[(1-z)^3-3tz^2+2tz^3-t^2*z^3].

%e T(5,3) = 6 because we have 1/02/1/0, 2/02/1/0, 2/1/01/0, 2/1/02/0, 2/12/1/0 and 2/1/02/1, the middle points of the drops being indicated by /.

%e Triangle starts:

%e 1;

%e 3;

%e 6, 3;

%e 10, 16, 1;

%e 15, 51, 15;

%e 21, 126, 90, 6;

%p G:=1/((1-z)^3-3*t*z^2+2*t*z^3-t^2*z^3): Gser:=simplify(series(G,z=0,15)): P[0]:=1: for n from 1 to 12 do P[n]:=sort(coeff(Gser,z^n)) od: for n from 0 to 12 do seq(coeff(P[n],t,j),j=0..floor(2*n/3)) od; # yields sequence in triangular form

%p # second Maple program:

%p b:= proc(n, i) option remember; `if`(n=0, 1, expand(

%p add(b(n-1, j)*`if`(j<i, x, 1), j=0..2)))

%p end:

%p T:= n-> (p-> seq(coeff(p, x, i), i=0..degree(p)))(b(n, 0)):

%p seq(T(n), n=0..15); # _Alois P. Heinz_, May 19 2014

%t sol=Solve[{a==v z^2,b==v z^2,c==v(z^2+a z)},{a,b,c}];f[z_,u_]:=1/(1-3z-a-b-c)/.sol/.v->u-1;nn=10;Map[Select[#,#>0&]&,Level[CoefficientList[Series[f[z,u],{z,0,nn}],{z,u}],{2}]]//Grid (* _Geoffrey Critzer_, May 19 2014 *)

%Y Cf. A000244, A000217, A036290.

%K nonn,tabf

%O 0,2

%A _Emeric Deutsch_, Jul 15 2006