%I #15 Mar 27 2022 19:03:46
%S 1,2,1,5,3,1,14,7,5,1,41,15,17,7,1,122,31,49,31,9,1,365,63,129,111,49,
%T 11,1,1094,127,321,351,209,71,13,1,3281,255,769,1023,769,351,97,15,1,
%U 9842,511,1793,2815,2561,1471,545,127,17,1
%N Triangle A007318 * A193554, read by rows.
%C Row sums = 3^n.
%C Left column = A007051: (1, 2, 5, 14, 41, 122, ...).
%H G. C. Greubel, <a href="/A135233/b135233.txt">Rows n = 0..100 of triangle, flattened</a>
%F Binomial transform of A193554, as infinite lower triangular matrices.
%F T(n,k) = Sum_{j=0..n-k} (-1)^(n-k+j)*binomial(n,j)*2^j, with T(n,n) = 1, and T(n,0) = (3^n + 1)/2. - _G. C. Greubel_, Nov 20 2019
%e First few rows of the triangle:
%e 1;
%e 2, 1;
%e 5, 3, 1;
%e 14, 7, 5, 1;
%e 41, 15, 17, 7, 1;
%e ...
%p T:= proc(n, k) option remember;
%p if k=n then 1
%p elif k=0 then (3^n_1)/2
%p else add((-1)^(n-k+j)*binomial(n, j)*2^j, j=0..n-k)
%p fi; end:
%p seq(seq(T(n, k), k=0..n), n=0..12); # _G. C. Greubel_, Nov 20 2019
%t T[n_, k_]:= T[n, k]= If[k==n, 1, If[k==0, (3^n+1)/2, Sum [(-1)^(n-k+i)* Binomial[n, i]*2^i, {i, 0, n-k}]]]; Table[T[n, k], {n, 0, 12}, {k, 0, n}]//Flatten (* _G. C. Greubel_, Nov 20 2019 *)
%o (PARI) T(n,k) = if(k==n, 1, if(k==0, (3^n+1)/2, sum(j=0, n-k, (-1)^(n-k+j)*binomial(n,j)*2^j) )); \\ _G. C. Greubel_, Nov 20 2019
%o (Magma)
%o function T(n,k)
%o if k eq n then return 1;
%o elif k eq 0 then return (3^n+1)/2;
%o else return (&+[(-1)^(n-k+j)*2^j*Binomial(n, j): j in [0..n-k]]);
%o end if; return T; end function;
%o [T(n,k): k in [0..n], n in [0..12]]; // _G. C. Greubel_, Nov 20 2019
%o (Sage)
%o @CachedFunction
%o def T(n, k):
%o if (k==n): return 1
%o elif (k==0): return (3^n+1)/2
%o else: return sum((-1)^(n-k+j)*2^j*binomial(n, j) for j in (0..n-k))
%o [[T(n, k) for k in (0..n)] for n in (0..12)] # _G. C. Greubel_, Nov 20 2019
%Y Cf. A007051, A007318, A118801, A119258, A193554.
%K nonn,tabl
%O 0,2
%A _Gary W. Adamson_, Nov 23 2007
%E Definition corrected by _N. J. A. Sloane_, Jul 30 2011