OFFSET
0,2
COMMENTS
LINKS
G. C. Greubel, Rows n=0..100 of triangle, flattened
FORMULA
Number triangle T(n,k) = Sum_{j=0..k+1} C(k+1,j)*C(n-j,n-k-j)* (-1)^j * 3^(n-k-j).
T(n,k) = 3*T(n-1,k) + T(n-1,k-1) - T(n-2,k-1), T(0,0)=1, T(1,0)=2, T(1,1)=1, T(n,k)=0 if k>n or if k<n. - Philippe Deléham, Jan 08 2013
EXAMPLE
Triangle begins
1;
2, 1;
6, 4, 1;
18, 16, 6, 1;
54, 60, 30, 8, 1;
162, 216, 134, 48, 10, 1;
MAPLE
seq(seq( add( (-1)^j*3^(n-k-j)*binomial(k+1, j)*binomial(n-j, n-k-j), j=0..n), k=0..n), n=0..10); # G. C. Greubel, Oct 28 2019
MATHEMATICA
T[0, 0]=1; T[1, 0]=2; T[1, 1]=1; T[n_, k_]/; 0<=k<=n:= T[n, k]= 3T[n-1, k] + T[n-1, k-1] - T[n-2, k-1]; T[_, _]=0; Table[T[n, k], {n, 0, 9}, {k, 0, n}] (* Jean-François Alcover, Jun 13 2019 *)
T[n_, k_]:= Sum[(-1)^j*3^(n-k-j)*Binomial[k+1, j]*Binomial[n-j, n-k-j], {j, 0, n}]; Table[T[n, k], {n, 0, 10}, {k, 0, n}]//Flatten (* G. C. Greubel, Oct 28 2019 *)
PROG
(PARI) T(n, k) = sum(j=0, n, (-1)^j*3^(n-k-j)*binomial(k+1, j)*binomial(n-j, n-k-j));
for(n=0, 10, for(k=0, n, print1(T(n, k), ", "))) \\ G. C. Greubel, Oct 28 2019
(Magma) T:= func< n, k | &+[(-1)^j*3^(n-k-j)*Binomial(k+1, j)*Binomial(n-j, n-k-j): j in [0..n]] >;
[T(n, k): k in [0..n], n in [0..10]]; // G. C. Greubel, Oct 28 2019
(Sage) [[sum( (-1)^j*3^(n-k-j)*binomial(k+1, j)*binomial(n-j, n-k-j) for j in (0..n) ) for k in (0..n)] for n in (0..10)] # G. C. Greubel, Oct 28 2019
(GAP) Flat(List([0..10], n-> List([0..n], k-> Sum([0..n], j->
(-1)^j*3^(n-k-j)*Binomial(k+1, j)*Binomial(n-j, n-k-j) )))); # G. C. Greubel, Oct 28 2019
CROSSREFS
KEYWORD
AUTHOR
Paul Barry, Nov 30 2006
STATUS
approved