%I #37 Oct 18 2022 16:36:24
%S 1,3,3,9,18,9,27,81,81,27,81,324,486,324,81,243,1215,2430,2430,1215,
%T 243,729,4374,10935,14580,10935,4374,729,2187,15309,45927,76545,76545,
%U 45927,15309,2187,6561,52488,183708,367416,459270,367416,183708,52488,6561
%N Triangle whose (i,j)-th entry is binomial(i,j)*3^(i-j)*3^j.
%C Triangle of coefficients in expansion of (3 + 3x)^n = 3^n (1 +x)^n, where n is a nonnegative integer. (Coefficients in expansion of (1 +x)^n are given in A007318: Pascal's triangle). - _Zagros Lalo_, Jul 23 2018
%D Shara Lalo and Zagros Lalo, Polynomial Expansion Theorems and Number Triangles, Zana Publishing, 2018, ISBN: 978-1-9995914-0-3, pp. 44, 48
%H Indranil Ghosh, <a href="/A038221/b038221.txt">Rows 0..100 of triangle, flattened</a>
%H B. N. Cyvin et al., <a href="http://match.pmf.kg.ac.rs/electronic_versions/Match34/match34_109-121.pdf">Isomer enumeration of unbranched catacondensed polygonal systems with pentagons and heptagons</a>, Match, No. 34 (Oct 1996), pp. 109-121.
%F G.f.: 1/(1 - 3*x - 3*x*y). - _Ilya Gutkovskiy_, Apr 21 2017
%F T(0,0) = 1; T(n,k) = 3 T(n-1,k) + 3 T(n-1,k-1) for k = 0...n; T(n,k)=0 for n or k < 0. - _Zagros Lalo_, Jul 23 2018
%F From _G. C. Greubel_, Oct 17 2022: (Start)
%F T(n, k) = T(n, n-k).
%F T(n, n) = A000244(n).
%F T(n, n-1) = 3*A027471(n).
%F T(n, n-2) = 9*A027472(n+1).
%F T(n, n-3) = 27*A036216(n-3).
%F T(n, n-4) = 81*A036217(n-4).
%F T(n, n-5) = 243*A036219(n-5).
%F Sum_{k=0..n} T(n, k) = A000400(n).
%F Sum_{k=0..n} (-1)^k * T(n, k) = A000007(n).
%F Sum_{k=0..floor(n/2)} T(n-k, k) = A030195(n+1), n >= 0.
%F Sum_{k=0..floor(n/2)} (-1)^k * T(n-k, k) = A057083(n).
%F T(n, k) = 3^k * A027465(n, k). (End)
%e Triangle begins as:
%e 1;
%e 3, 3;
%e 9, 18, 9;
%e 27, 81, 81, 27;
%e 81, 324, 486, 324, 81;
%e 243, 1215, 2430, 2430, 1215, 243;
%e 729, 4374, 10935, 14580, 10935, 4374, 729;
%e 2187, 15309, 45927, 76545, 76545, 45927, 15309, 2187;
%e 6561, 52488, 183708, 367416, 459270, 367416, 183708, 52488, 6561;
%t (* programs from _Zagros Lalo_, Jul 23 2018 *)
%t t[0, 0]=1; t[n_, k_]:= t[n, k]= If[n<0 || k<0, 0, 3 t[n-1, k] + 3 t[n-1, k-1]]; Table[t[n, k], {n,0,10}, {k,0,n}]//Flatten
%t Table[CoefficientList[Expand[3^n *(1+x)^n], x], {n,0,10}]//Flatten
%t Table[3^n Binomial[n, k], {n,0,10}, {k,0,n}]//Flatten (* End *)
%o (Haskell)
%o a038221 n = a038221_list !! n
%o a038221_list = concat $ iterate ([3,3] *) [1]
%o instance Num a => Num [a] where
%o fromInteger k = [fromInteger k]
%o (p:ps) + (q:qs) = p + q : ps + qs
%o ps + qs = ps ++ qs
%o (p:ps) * qs'@(q:qs) = p * q : ps * qs' + [p] * qs
%o _ * _ = []
%o -- _Reinhard Zumkeller_, Apr 02 2011
%o (GAP) Flat(List([0..8],i->List([0..i],j->Binomial(i,j)*3^(i-j)*3^j))); # _Muniru A Asiru_, Jul 23 2018
%o (Magma) [3^n*Binomial(n,k): k in [0..n], n in [0..10]]; // _G. C. Greubel_, Oct 17 2022
%o (SageMath)
%o def A038221(n,k): return 3^n*binomial(n,k)
%o flatten([[A038221(n,k) for k in range(n+1)] for n in range(10)]) # _G. C. Greubel_, Oct 17 2022
%Y Cf. A007318, A304236, A304249.
%Y Cf. A000007, A000400, A027465, A030195, A057083.
%Y Columns k: A000244 (k=0), 3*A027471 (k=1), 3^2*A027472 (k=2), 3^3*A036216 (k=3), 3^4*A036217 (k=4), 3^5*A036219 (k=5), 3^6*A036220 (k=6), 3^7*A036221 (k=7), 3^8*A036222 (k=8), 3^9*A036223 (k=9), 3^10*A172362 (k=10).
%K nonn,tabl,easy
%O 0,2
%A _N. J. A. Sloane_