%I #8 Apr 14 2021 06:29:19
%S 1,1,1,1,6,1,1,21,21,1,1,66,126,66,1,1,201,576,576,201,1,1,606,2331,
%T 3456,2331,606,1,1,1821,8811,17361,17361,8811,1821,1,1,5466,31896,
%U 78516,104166,78516,31896,5466,1,1,16401,112086,331236,548046,548046,331236,112086,16401,1
%N Triangle T(n, k) = T(n-1, k-1) + 3*T(n-1, k) + 2*T(n-1, k-1), with T(n,1) = T(n, n) = 1, read by rows.
%H G. C. Greubel, <a href="/A142596/b142596.txt">Rows n = 1..50 of the triangle, flattened</a>
%F T(n, k) = T(n-1, k-1) + 3*T(n-1, k) + 2*T(n-1, k-1), with T(n,1) = T(n, n) = 1.
%F Sum_{k=1..n} T(n, k) = (6^(n-1) + 4)/5 = A047851(n-1). - _G. C. Greubel_, Apr 13 2021
%e The triangle begins as:
%e 1;
%e 1, 1;
%e 1, 6, 1;
%e 1, 21, 21, 1;
%e 1, 66, 126, 66, 1;
%e 1, 201, 576, 576, 201, 1;
%e 1, 606, 2331, 3456, 2331, 606, 1;
%e 1, 1821, 8811, 17361, 17361, 8811, 1821, 1;
%e 1, 5466, 31896, 78516, 104166, 78516, 31896, 5466, 1;
%e 1, 16401, 112086, 331236, 548046, 548046, 331236, 112086, 16401, 1;
%t T[n_, k_]:= T[n,k]= If[k==1 || k==n, 1, T[n-1, k-1] +3*T[n-1, k] +2*T[n-1, k-1]];
%t Table[T[n, k], {n, 10}, {k, n}]//Flatten (* modified by _G. C. Greubel_, Apr 13 2021 *)
%o (Magma)
%o function T(n,k)
%o if k eq 1 or k eq n then return 1;
%o else return T(n-1, k-1) + 3*T(n-1, k) + 2*T(n-1, k-1);
%o end if; return T;
%o end function;
%o [T(n,k): k in [1..n], n in [1..12]]; // _G. C. Greubel_, Apr 13 2021
%o (Sage)
%o @CachedFunction
%o def T(n,k): return 1 if k==1 or k==n else T(n-1, k-1) + 3*T(n-1, k) + 2*T(n-1, k-1)
%o flatten([[T(n,k) for k in (1..n)] for n in (1..12)]) # _G. C. Greubel_, Apr 13 2021
%Y Cf. A008292, A047851, A060187, A119258.
%K nonn,tabl
%O 1,5
%A _Roger L. Bagula_, Sep 22 2008
%E Edited by _G. C. Greubel_, Apr 13 2021