login
Triangle read by rows, T(n,k) for 0<=k<=n, generalizes the colored Motzkin paths of A129400.
3

%I #31 Oct 24 2024 04:18:49

%S 1,2,1,8,4,1,32,20,6,1,144,96,36,8,1,672,480,200,56,10,1,3264,2432,

%T 1104,352,80,12,1,16256,12544,6048,2128,560,108,14,1,82688,65536,

%U 33152,12544,3680,832,140,16,1,427520,346368,182016,72960,23232,5904,1176,176,18,1

%N Triangle read by rows, T(n,k) for 0<=k<=n, generalizes the colored Motzkin paths of A129400.

%H G. C. Greubel, <a href="/A201641/b201641.txt">Rows n = 0..100 of triangle, flattened</a>

%F Recurrence: T(0,0)=1, T(0,k)=0 for k>0 and for n>=1 T(n,k) = T(n-1,k-1) + 2*T(n-1,k) + 4*T(n-1,k+1).

%F T(n,k) = ((k+1)/(n+1))*2^(n-k)*Sum_{j=0..floor((n-k)/3)} (-1)^j*C(n+1,j) *C(2*n-k-3*j,n-k-3*j). - _Vladimir Kruchinin_, Apr 06 2019

%F T(n,k) = 2^n*Sum_{j=0..n} C(n,j)*(C(n-j, j+k) - C(n-j, j+k+2))*2^(-k). - _Peter Luschny_, Dec 31 2019

%e Triangle begins as:

%e [0] [1]

%e [1] [2, 1]

%e [2] [8, 4, 1]

%e [3] [32, 20, 6, 1]

%e [4] [144, 96, 36, 8, 1]

%e [5] [672, 480, 200, 56, 10, 1]

%e [6] [3264, 2432, 1104, 352, 80, 12, 1]

%e [7] [16256, 12544, 6048, 2128, 560, 108, 14, 1]

%e [8] [82688, 65536, 33152, 12544, 3680, 832, 140, 16, 1]

%p T := (n, k) -> 2^n*add(binomial(n,j)*(binomial(n-j,j+k) - binomial(n-j, j+k+2)) *2^(-k), j=0..n); seq(seq(T(n,k), k=0..n), n=0..8); # _Peter Luschny_, Dec 31 2019

%t T[n_, k_]:= If[k==n, 1, 2^(n-k)*((k+1)/(n+1))*Sum[(-1)^j*Binomial[n+1,j]* Binomial[2*n-k-3*j, n-k-3*j], {j, 0, Floor[(n-k)/3]}]];

%t Table[T[n, k], {n, 0, 10}, {k, 0, n}] (* _G. C. Greubel_, Apr 04 2019 *)

%o (Sage)

%o def A201641_triangle(dim):

%o M = matrix(ZZ,dim,dim)

%o for n in range(dim): M[n,n] = 1

%o for n in (1..dim-1):

%o for k in (0..n-1):

%o M[n,k] = M[n-1,k-1]+2*M[n-1,k]+4*M[n-1,k+1]

%o return M

%o A201641_triangle(9)

%o (Sage)

%o @CachedFunction

%o def T(n, k):

%o if k==n: return 1

%o else: return 2^(n-k)*((k+1)/(n+1))*sum((-1)^j*binomial(n+1,j)* binomial(2*n-k-3*j, n-k-3*j) for j in (0..floor((n-k)/3)))

%o [[T(n,k) for k in (0..n)] for n in (0..10)] # _G. C. Greubel_, Apr 05 2019

%o (Maxima)

%o T(n,k):=(k+1)/(n+1)*2^(n-k)*sum((-1)^j*binomial(n+1,j)*binomial(2*n-k-3*j,n-k-3*j),j,0,floor((n-k)/3)); /* _Vladimir Kruchinin_, Apr 06 2019 */

%o (PARI) {T(n,k) = if(k==n, 1, 2^(n-k)*((k+1)/(n+1))*sum(j=0, floor((n-k)/3), (-1)^j*binomial(n+1,j)*binomial(2*n-k-3*j, n-k-3*j)))};

%o for(n=0,10, for(k=0,n, print1(T(n,k), ", "))) \\ _G. C. Greubel_, Apr 04 2019

%o (Magma) [[k eq n select 1 else 2^(n-k)*((k+1)/(n+1))*(&+[(-1)^j* Binomial(n+1,j)*Binomial(2*n-k-3*j, n-k-3*j): j in [0..Floor((n-k)/3)]]) :k in [0..n]]: n in [0..10]]; // _G. C. Greubel_, Apr 05 2019

%Y Cf. A129400.

%K nonn,tabl

%O 0,2

%A _Peter Luschny_, Sep 20 2012