%I #5 Feb 16 2021 17:49:06
%S 1,1,1,1,10,1,1,29,29,1,1,84,167,84,1,1,247,738,738,247,1,1,734,2930,
%T 4393,2930,734,1,1,2193,10955,21904,21904,10955,2193,1,1,6568,39393,
%U 98470,131289,98470,39393,6568,1,1,19691,137816,413426,689030,689030,413426,137816,19691,1
%N Triangle T(n, k, q) = binomial(n, k) + q^n*binomial(n-2, k-1) - 1 with T(n, 0) = T(n, n) = 1 and q = 3, read by rows.
%C The triangle sequences having the form T(n,k,q) = binomial(n, k) + q^n*binomial(n-2, k-1) - 1 have the row sums Sum_{k=0..n} T(n,k,q) = 2^(n-2)*q^n + 2^n - (n-1) - (5/4)*[n=0] -(q/2)*[n=1]. - _G. C. Greubel_, Feb 16 2021
%H G. C. Greubel, <a href="/A173047/b173047.txt">Rows n = 0..100 of the triangle, flattened</a>
%F T(n, k, q) = binomial(n, k) + q^n*binomial(n-2, k-1) - 1 with T(n, 0) = T(n, n) = 1 and q = 3.
%F Sum_{k=0..n} T(n, k, 3) = (1/4)*(6^n + 2^(n+2) - 4*(n-1) - 5*[n=0] - 6*[n=1]). - _G. C. Greubel_, Feb 16 2021
%e Ttiangle begins as:
%e 1;
%e 1, 1;
%e 1, 10, 1;
%e 1, 29, 29, 1;
%e 1, 84, 167, 84, 1;
%e 1, 247, 738, 738, 247, 1;
%e 1, 734, 2930, 4393, 2930, 734, 1;
%e 1, 2193, 10955, 21904, 21904, 10955, 2193, 1;
%e 1, 6568, 39393, 98470, 131289, 98470, 39393, 6568, 1;
%e 1, 19691, 137816, 413426, 689030, 689030, 413426, 137816, 19691, 1;
%t T[n_, k_, q_]:= If[k==0 || k==n, 1, Binomial[n, k] +(q^n)*Binomial[n-2, k-1] -1];
%t Table[T[n,k,3], {n,0,12}, {k,0,n}]//Flatten (* modified by _G. C. Greubel_, Feb 16 2021 *)
%o (Sage)
%o def T(n,k,q): return 1 if (k==0 or k==n) else binomial(n,k) + q^n*binomial(n-2,k-1) -1
%o flatten([[T(n,k,3) for k in (0..n)] for n in (0..12)]) # _G. C. Greubel_, Feb 16 2021
%o (Magma)
%o T:= func< n,k,q | k eq 0 or k eq n select 1 else Binomial(n,k) + q^n*Binomial(n-2,k-1) -1 >;
%o [T(n,k,3): k in [0..n], n in [0..12]]; // _G. C. Greubel_, Feb 16 2021
%Y Cf. A132044 (q=0), A173075 (q=1), A173046 (q=2), this sequence (q=3).
%K nonn,tabl
%O 0,5
%A _Roger L. Bagula_, Feb 08 2010
%E Edited by _G. C. Greubel_, Feb 16 2021