OFFSET
0,2
COMMENTS
Row sums give A033484(n).
The number of spotlight tilings of an (m+1) X (n+1) rectangle, read by antidiagonals. - Bridget Tenner, Nov 09 2007
T(n,k) = A209561(n+2,k+1), 0 <= k <= n. - Reinhard Zumkeller, Dec 26 2012
For a closed-form formula for arbitrary left and right borders of Pascal like triangle see A228196. - Boris Putievskiy, Aug 19 2013
For a closed-form formula for generalized Pascal's triangle see A228576. - Boris Putievskiy, Sep 09 2013
LINKS
Reinhard Zumkeller, Rows n = 0..120 of triangle, flattened
B. E. Tenner, Spotlight tiling, Ann. Combin. 14 (4) (2010) 553.
FORMULA
T(2n,n) = A051924(n+1). - Philippe Deléham, Nov 26 2006
T(m,n) = binomial(m+n,m) - binomial(m+n-2,m-1) (correct up to offset and transformation of square indices to triangular indices). - Bridget Tenner, Nov 09 2007
T(0,n) = T(n,0) = n+1, T(n,k) = T(n-1,k) + T(n-1,k-1), 0 < k < n.
From Peter Bala, Feb 28 2013: (Start)
T(n,k) = binomial(n,k-1) + binomial(n,k) + binomial(n,k+1) for 0 <= k <= n.
O.g.f.: (1 - xt^2)/((1 - t)(1 - xt)(1 - (1+x)t)) = 1 + (2 + 2x)t + (3 + 4x + 3x^2)t^2 + ....
Row polynomials: ((1+x+x^2)*(1+x)^n - 1 - x^(n+2))/x. (End)
EXAMPLE
Triangle begins as:
1;
2, 2;
3, 4, 3;
4, 7, 7, 4;
5, 11, 14, 11, 5;
MAPLE
T:= proc(n, k) option remember;
`if`(k<0 or k>n, 0,
`if`(k=0 or k=n, n+1,
T(n-1, k-1) + T(n-1, k) ))
end:
seq(seq(T(n, k), k=0..n), n=0..14); # Alois P. Heinz, May 27 2013
MATHEMATICA
NestList[Append[ Prepend[Map[Apply[Plus, #] &, Partition[#, 2, 1]], #[[1]] + 1], #[[1]] + 1] &, {1}, 10] // Grid (* Geoffrey Critzer, May 26 2013 *)
T[n_, k_] := T[n, k] = If[k<0 || k>n, 0, If[k==0 || k==n, n+1, T[n-1, k-1] + T[n-1, k]]]; Table[T[n, k], {n, 0, 14}, {k, 0, n}] // Flatten (* Jean-François Alcover, Jan 09 2016, after Alois P. Heinz *)
PROG
(Haskell)
a051597 n k = a051597_tabl !! n !! k
a051597_row n = a051597_tabl !! n
a051597_tabl = iterate (\row -> zipWith (+) ([1] ++ row) (row ++ [1])) [1]
-- Reinhard Zumkeller, Nov 23 2012
(PARI) T(n, k) = if(k<0 || k>n, 0, if(k==0 || k==n, n+1, T(n-1, k-1) + T(n-1, k) ));
for(n=0, 12, for(k=0, n, print1(T(n, k), ", "))) \\ G. C. Greubel, Nov 18 2019
(Magma)
function T(n, k)
if k lt 0 or k gt n then return 0;
elif k eq 0 or k eq n then return n+1;
else return T(n-1, k-1) + T(n-1, k);
end if;
return T;
end function;
[T(n, k): k in [0..n], n in [0..12]]; // G. C. Greubel, Nov 18 2019
(Sage)
@CachedFunction
def T(n, k):
if (k<0 or k>n): return 0
elif (k==0 or k==n): return n+1
else: return T(n-1, k-1) + T(n-1, k)
[[T(n, k) for k in (0..n)] for n in (0..12)] # G. C. Greubel, Nov 18 2019
(GAP)
T:= function(n, k)
if k<0 or k>n then return 0;
elif k=0 or k=n then return n+1;
else return T(n-1, k-1) + T(n-1, k);
fi;
end;
Flat(List([0..12], n-> List([0..n], k-> T(n, k) ))); # G. C. Greubel, Nov 18 2019
CROSSREFS
KEYWORD
AUTHOR
STATUS
approved