OFFSET
1,5
LINKS
G. C. Greubel, Rows n = 1..50 of the triangle, flattened
FORMULA
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.
Sum_{k=1..n} T(n, k) = (6^(n-1) + 4)/5 = A047851(n-1). - G. C. Greubel, Apr 13 2021
EXAMPLE
The triangle begins as:
1;
1, 1;
1, 6, 1;
1, 21, 21, 1;
1, 66, 126, 66, 1;
1, 201, 576, 576, 201, 1;
1, 606, 2331, 3456, 2331, 606, 1;
1, 1821, 8811, 17361, 17361, 8811, 1821, 1;
1, 5466, 31896, 78516, 104166, 78516, 31896, 5466, 1;
1, 16401, 112086, 331236, 548046, 548046, 331236, 112086, 16401, 1;
MATHEMATICA
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]];
Table[T[n, k], {n, 10}, {k, n}]//Flatten (* modified by G. C. Greubel, Apr 13 2021 *)
PROG
(Magma)
function T(n, k)
if k eq 1 or k eq n then return 1;
else return T(n-1, k-1) + 3*T(n-1, k) + 2*T(n-1, k-1);
end if; return T;
end function;
[T(n, k): k in [1..n], n in [1..12]]; // G. C. Greubel, Apr 13 2021
(Sage)
@CachedFunction
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)
flatten([[T(n, k) for k in (1..n)] for n in (1..12)]) # G. C. Greubel, Apr 13 2021
CROSSREFS
KEYWORD
nonn,tabl
AUTHOR
Roger L. Bagula, Sep 22 2008
EXTENSIONS
Edited by G. C. Greubel, Apr 13 2021
STATUS
approved