login
Triangular array read by rows: T(n,1) = T(n,n) = 1, T(n,k) = 3*T(n-1,k-1) + 2*T(n-1,k).
6

%I #18 Sep 08 2022 08:45:25

%S 1,1,1,1,5,1,1,13,17,1,1,29,73,53,1,1,61,233,325,161,1,1,125,649,1349,

%T 1297,485,1,1,253,1673,4645,6641,4861,1457,1,1,509,4105,14309,27217,

%U 29645,17497,4373,1,1,1021,9737,40933,97361,140941,123929,61237,13121,1

%N Triangular array read by rows: T(n,1) = T(n,n) = 1, T(n,k) = 3*T(n-1,k-1) + 2*T(n-1,k).

%C Second column is like A036563.

%C Second diagonal is A048473.

%H G. C. Greubel, <a href="/A119725/b119725.txt">Rows n = 1..100 of triangle, flattened</a>

%H Termeszet Vilaga A XI. Természet-Tudomány Diákpályázat díjnyertesei 133.EVF. 6.SZ. jun. 2002. Vegh Lea (and Vegh Erika): <a href="http://www.termeszetvilaga.hu/tv2002/tv0206/tartalom.html">Pascal-tipusu haromszogek</a>

%e Triangle begins:

%e 1;

%e 1, 1;

%e 1, 5, 1;

%e 1, 13, 17, 1;

%e 1, 29, 73, 53, 1;

%e 1, 61, 233, 325, 161, 1;

%e 1, 125, 649, 1349, 1297, 485, 1;

%e 1, 253, 1673, 4645, 6641, 4861, 1457, 1;

%e 1, 509, 4105, 14309, 27217, 29645, 17497, 4373, 1;

%e 1, 1021, 9737, 40933, 97361, 140941, 123929, 61237, 13121, 1;

%p T:= proc(n, k) option remember;

%p if k=1 and k=n then 1

%p else 3*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 18 2019

%t T[n_, k_]:= T[n, k]= If[k==1 || k==n, 1, 3*T[n-1, k-1] + 2*T[n-1, k]]; Table[T[n,k], {n,10}, {k,n}]//Flatten (* _G. C. Greubel_, Nov 18 2019 *)

%o (PARI) T(n,k) = if(k==1 || k==n, 1, 3*T(n-1,k-1) + 2*T(n-1,k)); \\ _G. C. Greubel_, Nov 18 2019

%o (Magma)

%o function T(n,k)

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

%o else return 3*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 18 2019

%o (Sage)

%o @CachedFunction

%o def T(n, k):

%o if (k==1 or k==n): return 1

%o else: return 3*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 18 2019

%Y Cf. A007318, A036563, A048473, A119726, A119727.

%K easy,nonn,tabl

%O 1,5

%A _Zerinvary Lajos_, Jun 14 2006

%E Edited by _Don Reble_, Jul 24 2006