%I #55 Sep 08 2022 08:44:38
%S 1,1,3,1,6,9,1,9,27,27,1,12,54,108,81,1,15,90,270,405,243,1,18,135,
%T 540,1215,1458,729,1,21,189,945,2835,5103,5103,2187,1,24,252,1512,
%U 5670,13608,20412,17496,6561,1,27,324,2268,10206,30618,61236,78732,59049,19683
%N Triangle of coefficients in expansion of (1+3*x)^n.
%C T(n,k) is the number of lattice paths from (0,0) to (n,k) with steps (1,0) and three kinds of steps (1,1). The number of paths with steps (1,0) and s kinds of steps (1,1) corresponds to the expansion of (1+s*x)^n. - _Joerg Arndt_, Jul 01 2011
%C Rows of A027465 reversed. - _Michael Somos_, Feb 14 2002
%C T(n,k) equals the number of n-length words on {0,1,2,3} having n-k zeros. - _Milan Janjic_, Jul 24 2015
%C T(n-1,k-1) is the number of 3-compositions of n with zeros having k positive parts; see Hopkins & Ouvry reference. - _Brian Hopkins_, Aug 16 2020
%H Reinhard Zumkeller, <a href="/A013610/b013610.txt">Rows n = 0..125 of triangle, flattened</a>
%H J. Goldman and J. Haglund, <a href="http://dx.doi.org/10.1006/jcta.2000.3113">Generalized rook polynomials</a>, J. Combin. Theory A91 (2000), 509-530, 1-rook coefficients on the 3xn board (all heights 3) with k rooks
%H Brian Hopkins and Stéphane Ouvry, <a href="https://arxiv.org/abs/2008.04937">Combinatorics of Multicompositions</a>, arXiv:2008.04937 [math.CO], 2020.
%F G.f.: 1 / (1 - x*(1+3*y)).
%F Row sums are 4^n. - _Joerg Arndt_, Jul 01 2011
%F T(n,k) = 3^k*C(n,k) = Sum_{i=n-k..n} C(i,n-k)*C(n,i)*2^(n-i). - _Mircea Merca_, Apr 28 2012
%F From _Peter Bala_, Dec 22 2014: (Start)
%F Riordan array ( 1/(1 - x), 3*x/(1 - x) ).
%F exp(3*x) * e.g.f. for row n = e.g.f. for diagonal n. For example, for n = 3 we have exp(3*x)*(1 + 9*x + 27*x^2/2! + 27*x^3/3!) = 1 + 12*x + 90*x^2/2! + 540*x^3/3! + 2835*x^4/4! + .... The same property holds more generally for Riordan arrays of the form ( f(x), 3*x/(1 - x) ). (End)
%F T(n,k) = Sum_{j=0..k} (-1)^(k-j) * binomial(n,k) * binomial(k,j) * 4^j. - _Kolosov Petro_, Jan 28 2019
%e Triangle begins
%e 1;
%e 1, 3;
%e 1, 6, 9;
%e 1, 9, 27, 27;
%e 1, 12, 54, 108, 81;
%e 1, 15, 90, 270, 405, 243;
%e 1, 18, 135, 540, 1215, 1458, 729;
%e 1, 21, 189, 945, 2835, 5103, 5103, 2187;
%p T:= n-> (p-> seq(coeff(p, x, k), k=0..n))((1+3*x)^n):
%p seq(T(n), n=0..10); # _Alois P. Heinz_, Jul 25 2015
%t t[n_, k_] := Binomial[n, k]*3^(n-k); Table[t[n, n-k], {n, 0, 9}, {k, 0, n}] // Flatten (* _Jean-François Alcover_, Mar 05 2013 *)
%t BinomialROW[n_, k_, t_] := Sum[Binomial[n, k]*Binomial[k, j]*(-1)^(k - j)*t^j, {j, 0, k}]; Column[Table[BinomialROW[n, k, 4], {n, 0, 10}, {k, 0, n}], Center] (* _Kolosov Petro_, Jan 28 2019 *)
%o (PARI) {T(n, k) = polcoeff((1 + 3*x)^n, k)}; /* _Michael Somos_, Feb 14 2002 */
%o (PARI) /* same as in A092566 but use */
%o steps=[[1,0], [1,1], [1,1], [1,1]]; /* note triple [1,1] */
%o /* _Joerg Arndt_, Jul 01 2011 */
%o (Haskell)
%o a013610 n k = a013610_tabl !! n !! k
%o a013610_row n = a013610_tabl !! n
%o a013610_tabl = iterate (\row ->
%o zipWith (+) (map (* 1) (row ++ [0])) (map (* 3) ([0] ++ row))) [1]
%o -- _Reinhard Zumkeller_, May 26 2013
%o (Magma) [3^k*Binomial(n,k): k in [0..n], n in [0..12]]; // _G. C. Greubel_, May 19 2021
%o (Sage) flatten([[3^k*binomial(n,k) for k in (0..n)] for n in (0..12)]) # _G. C. Greubel_, May 19 2021
%Y Cf. A007318, A013609, A027465, etc.
%Y Diagonals of the triangle: A000244 (k=n), A027471 (k=n-1), A027472 (k=n-2), A036216 (k=n-3), A036217 (k=n-4), A036219 (k=n-5), A036220 (k=n-6), A036221 (k=n-7), A036222 (k=n-8), A036223 (k=n-9), A172362 (k=n-10).
%K tabl,nonn,easy
%O 0,3
%A _N. J. A. Sloane_