login
Numbers in (3,2)-Pascal triangle (by row).
24

%I #40 Nov 13 2019 01:49:27

%S 1,3,2,3,5,2,3,8,7,2,3,11,15,9,2,3,14,26,24,11,2,3,17,40,50,35,13,2,3,

%T 20,57,90,85,48,15,2,3,23,77,147,175,133,63,17,2,3,26,100,224,322,308,

%U 196,80,19,2,3,29,126,324,546,630,504,276,99,21,2,3,32,155,450,870

%N Numbers in (3,2)-Pascal triangle (by row).

%C Reverse of A029600. - _Philippe Deléham_, Nov 21 2006

%C Triangle T(n,k), read by rows, given by (3,-2,0,0,0,0,0,0,0,...) DELTA (2,-1,0,0,0,0,0,0,0,...) where DELTA is the operator defined in A084938. - _Philippe Deléham_, Oct 10 2011

%C Row n: expansion of (3+2x)*(1+x)^(n-1), n>0. - _Philippe Deléham_, Oct 10 2011

%C For a closed-form formula for generalized Pascal's triangle see A228576. - _Boris Putievskiy_, Sep 04 2013

%H G. C. Greubel, <a href="/A029618/b029618.txt">Rows n = 0..100 of triangle, flattened</a>

%F T(n,k) = T(n-1,k-1) + T(n-1,k) with T(0,0)=1, T(n,0)=3, T(n,n)=2; n, k > 0. - _Boris Putievskiy_, Sep 04 2013

%F G.f.: (-1-x*y-2*x)/(-1+x*y+x). - _R. J. Mathar_, Aug 11 2015

%e Triangle begins as:

%e 1;

%e 3, 2;

%e 3, 5, 2;

%e 3, 8, 7, 2;

%e 3, 11, 15, 9, 2;

%e ...

%p A029618 := proc(n,k)

%p if k < 0 or k > n then

%p 0;

%p elif n = 0 then

%p 1;

%p elif k=0 then

%p 3;

%p elif k = n then

%p 2;

%p else

%p procname(n-1,k-1)+procname(n-1,k) ;

%p end if;

%p end proc: # _R. J. Mathar_, Jul 08 2015

%t T[n_, k_]:= T[n, k]= If[n==0 && k==0, 1, If[k==0, 3, If[k==n, 2, T[n-1, k-1] + T[n-1, k] ]]]; Table[T[n, k], {n, 0, 12}, {k, 0, n}]//Flatten (* _G. C. Greubel_, Nov 13 2019 *)

%o (PARI) T(n,k) = if(n==0 && k==0, 1, if(k==0, 3, if(k==n, 2, T(n-1, k-1) + T(n-1, k) ))); \\ _G. C. Greubel_, Nov 12 2019

%o (Sage)

%o @CachedFunction

%o def T(n, k):

%o if (n==0 and k==0): return 1

%o elif (k==0): return 3

%o elif (k==n): return 2

%o else: return T(n-1,k-1) + T(n-1, k)

%o [[T(n, k) for k in (0..n)] for n in (0..12)] # _G. C. Greubel_, Nov 12 2019

%o (GAP)

%o T:= function(n,k)

%o if n=0 and k=0 then return 1;

%o elif k=0 then return 3;

%o elif k=n then return 2;

%o else return T(n-1,k-1) + T(n-1,k);

%o fi;

%o end;

%o Flat(List([0..12], n-> List([0..n], k-> T(n,k) ))); # _G. C. Greubel_, Nov 12 2019

%Y Cf. A007318, A029600, A084938, A228196, A228576, A016789 (2nd column), A005449 (3rd column), A006002 (4th column).

%K nonn,easy,tabl

%O 0,2

%A _Mohammad K. Azarian_