%I #23 Sep 08 2022 08:45:17
%S 1,1,2,1,5,3,1,11,11,4,1,23,33,19,5,1,47,89,71,29,6,1,95,225,231,129,
%T 41,7,1,191,545,687,489,211,55,8,1,383,1281,1919,1665,911,321,71,9,1,
%U 767,2945,5119,5249,3487,1553,463,89,10,1,1535,6657,13183,15617,12223,6593,2479,641,109,11
%N Triangle read by rows: T(n,1) = 1, T(n,n) = n and for 1 < k < n: T(n,k) = T(n-1,k-1) + 2*T(n-1,k).
%C Sum of n-th row = 3^(n-1): Sum_{k=1..n} T(n,k) = A000244(n-1);
%C for n>1: T(n,2) = A083329(n-1), T(n,n-1) = A028387(n-2).
%H Reinhard Zumkeller, <a href="/A105728/b105728.txt">Rows n = 1..120 of triangle, flattened</a>
%e Triangle begins as:
%e 1;
%e 1, 2;
%e 1, 5, 3;
%e 1, 11, 11, 4;
%e 1, 23, 33, 19, 5;
%e 1, 47, 89, 71, 29, 6;
%e ...
%p T:= proc(n, k) option remember;
%p if k=1 then 1
%p elif k=n then n
%p else T(n-1, k-1) + 2*T(n-1, k)
%p fi
%p end:
%p seq(seq(T(n, k), k=1..n), n=1..12); # _G. C. Greubel_, Nov 13 2019
%t T[n_, k_]:= T[n, k]= If[k==1, 1, If[k==n, n, T[n-1, k-1] + 2*T[n-1, k]]];
%t Table[T[n, k], {n, 12}, {k, n}]//Flatten (* _G. C. Greubel_, Nov 13 2019 *)
%o (Haskell)
%o a105728 n k = a105728_tabl !! (n-1) !! (k-1)
%o a105728_row n = a105728_tabl !! (n-1)
%o a105728_tabl = iterate (\row -> zipWith (+) ([0] ++ tail row ++ [1]) $
%o zipWith (+) ([0] ++ row) (row ++ [0])) [1]
%o -- _Reinhard Zumkeller_, Jul 22 2013
%o (Magma)
%o function T(n,k)
%o if k eq 1 then return 1;
%o elif k eq n then return n;
%o else return T(n-1,k-1) + 2*T(n-1,k);
%o end if;
%o return T;
%o end function;
%o [T(n,k): k in [1..n], n in [1..12]]; // _G. C. Greubel_, Nov 13 2019
%o (Sage)
%o @CachedFunction
%o def T(n, k):
%o if (k==1): return 1
%o elif (k==n): return n
%o else: return T(n-1,k-1) + 2*T(n-1, k)
%o [[T(n, k) for k in (1..n)] for n in (1..12)] # _G. C. Greubel_, Nov 13 2019
%Y Cf. A013609, A115068.
%K nonn,tabl
%O 1,3
%A _Reinhard Zumkeller_, Apr 18 2005