%I #22 Mar 27 2023 03:44:24
%S 1,1,2,3,1,4,10,12,9,1,6,21,44,63,54,27,1,8,36,104,214,312,324,216,81,
%T 1,10,55,200,530,1052,1590,1800,1485,810,243,1,12,78,340,1095,2712,
%U 5284,8136,9855,9180,6318,2916,729,1,14,105,532,2009,5922,13993,26840,41979
%N Triangle, read by rows, where the n-th row lists the (2n+1) coefficients of (1+2*x+3*x^2)^n.
%H Alois P. Heinz, <a href="/A084608/b084608.txt">Rows n = 0..100, flattened</a>
%F From _G. C. Greubel_, Mar 27 2023: (Start)
%F T(n, k) = Sum_{j=0..k} binomial(n, k-j)*binomial(k-j, j)*2^(k-2*j)*3^j.
%F T(n, n) = A084609(n).
%F T(n, 2*n-1) = A212697(n), n >= 1.
%F T(n, 2*n) = A000244(n).
%F Sum_{j=0..2*n} T(n, k) = A000400(n).
%F Sum_{k=0..2*n} (-1)^k*T(n, k) = A000079(n).
%F Sum_{k=0..n} T(n-k, k) = A101822(n). (End)
%e Triangle begins:
%e 1;
%e 1, 2, 3;
%e 1, 4, 10, 12, 9;
%e 1, 6, 21, 44, 63, 54, 27;
%e 1, 8, 36, 104, 214, 312, 324, 216, 81;
%e 1, 10, 55, 200, 530, 1052, 1590, 1800, 1485, 810, 243;
%p f:= proc(n) option remember; expand((1+2*x+3*x^2)^n) end:
%p T:= (n,k)-> coeff(f(n), x, k):
%p seq(seq(T(n, k), k=0..2*n), n=0..10); # _Alois P. Heinz_, Apr 03 2011
%t row[n_] := (1+2x+3x^2)^n + O[x]^(2n+1) // CoefficientList[#, x]&; Table[row[n], {n, 0, 10}] // Flatten (* _Jean-François Alcover_, Feb 01 2017 *)
%o (PARI) for(n=0,10, for(k=0,2*n,t=polcoeff((1+2*x+3*x^2)^n,k,x); print1(t",")); print(" "))
%o (Haskell)
%o a084608 n = a084608_list !! n
%o a084608_list = concat $ iterate ([1,2,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 (Magma)
%o A084608:= func< n,k | (&+[Binomial(n, k-j)*Binomial(k-j, j)*2^(k-2*j)*3^j: j in [0..k]]) >;
%o [A084608(n,k): k in [0..2*n], n in [0..13]]; // _G. C. Greubel_, Mar 27 2023
%o (SageMath)
%o def A084608(n,k): return sum(binomial(n,j)*binomial(n-j,k-2*j)*2^(k-2*j)*3^j for j in range(k//2+1))
%o flatten([[A084608(n,k) for k in range(2*n+1)] for n in range(14)]) # _G. C. Greubel_, Mar 27 2023
%Y Cf. A000079, A000244, A000400, A002426, A084600 - A084606, A006139, A084609 - A084615, A101822, A212697.
%K nonn,tabf
%O 0,3
%A _Paul D. Hanna_, Jun 01 2003