login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

A051597
Rows of triangle formed using Pascal's rule except begin and end n-th row with n+1.
15
1, 2, 2, 3, 4, 3, 4, 7, 7, 4, 5, 11, 14, 11, 5, 6, 16, 25, 25, 16, 6, 7, 22, 41, 50, 41, 22, 7, 8, 29, 63, 91, 91, 63, 29, 8, 9, 37, 92, 154, 182, 154, 92, 37, 9, 10, 46, 129, 246, 336, 336, 246, 129, 46, 10, 11, 56, 175, 375, 582, 672, 582, 375, 175, 56, 11
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) = A134636(n,k) - A051601(n,k). - Reinhard Zumkeller, Nov 23 2012
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
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
Stripped variant of A072405, A122218.
Sequence in context: A241356 A065157 A235804 * A084193 A049787 A084192
KEYWORD
easy,nonn,tabl
AUTHOR
STATUS
approved