login
Triangle T(n,k) = 2*T(n-1, k-1) + 2*T(n-1, k), read by rows.
1

%I #15 Apr 14 2021 06:29:10

%S 1,1,1,1,4,1,1,10,10,1,1,22,40,22,1,1,46,124,124,46,1,1,94,340,496,

%T 340,94,1,1,190,868,1672,1672,868,190,1,1,382,2116,5080,6688,5080,

%U 2116,382,1,1,766,4996,14392,23536,23536,14392,4996,766,1

%N Triangle T(n,k) = 2*T(n-1, k-1) + 2*T(n-1, k), read by rows.

%C This triangle is dominated by the Eulerian numbers A008292.

%H G. C. Greubel, <a href="/A142595/b142595.txt">Rows n = 1..50 of the triangle, flattened</a>

%F Sum_{k=0..n} T(n, k) = (4^(n-1) + 2)/3 = A047849(n-1).

%e Triangle begins as:

%e 1;

%e 1, 1;

%e 1, 4, 1;

%e 1, 10, 10, 1;

%e 1, 22, 40, 22, 1;

%e 1, 46, 124, 124, 46, 1;

%e 1, 94, 340, 496, 340, 94, 1;

%e 1, 190, 868, 1672, 1672, 868, 190, 1;

%e 1, 382, 2116, 5080, 6688, 5080, 2116, 382, 1;

%e 1, 766, 4996, 14392, 23536, 23536, 14392, 4996, 766, 1;

%t T[n_, k_]:= T[n, k]= If[k==1 || k==n, 1, 2*(T[n-1, k-1] +T[n-1, k])];

%t Table[T[n, k], {n, 10}, {k, n}]//Flatten (* modified by _G. C. Greubel_, Apr 13 2021 *)

%t a[0] = {1}; a[1] = {1, 1};

%t a[n_]:= a[n]= 2*Join[a[n-1], {-1/2}] + 2*Join[{-1/2}, a[n-1]];

%t Table[a[n], {n,0,10}]//Flatten (* _Roger L. Bagula_, Dec 09 2008 *)

%o (Magma)

%o function T(n,k)

%o if k eq 1 or k eq n then return 1;

%o else return 2*(T(n-1, k-1) + T(n-1, k));

%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 2*(T(n-1, k-1) + T(n-1, k))

%o flatten([[T(n,k) for k in (1..n)] for n in (1..12)]) # _G. C. Greubel_, Apr 13 2021

%Y Cf. A008292, A047849 (row sums), A119258.

%K nonn,easy,tabl

%O 1,5

%A _Roger L. Bagula_, Sep 22 2008

%E Edited by _N. J. A. Sloane_, Dec 11 2008