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”).

A156580
Triangle T(n, k) = binomial(n-1, k-1) for n < 4, 2*(n + k - 4) + (-1)^n if k = (n+1)/2, 2*(n + k - 4) if k < floor(n/2) + 1, otherwise 2*(2*n - k - 3), with T(n, 0) = T(n, n) = 1, read by rows.
1
1, 1, 1, 1, 2, 1, 1, 4, 4, 1, 1, 6, 7, 6, 1, 1, 8, 10, 10, 8, 1, 1, 10, 12, 13, 12, 10, 1, 1, 12, 14, 16, 16, 14, 12, 1, 1, 14, 16, 18, 19, 18, 16, 14, 1, 1, 16, 18, 20, 22, 22, 20, 18, 16, 1, 1, 18, 20, 22, 24, 25, 24, 22, 20, 18, 1, 1, 20, 22, 24, 26, 28, 28, 26, 24, 22, 20, 1
OFFSET
1,5
FORMULA
T(n, k) = binomial(n-1, k-1) for n < 4, 2*(n + k - 4) + (-1)^n if k = (n+1)/2, 2*(n + k - 4) if k < floor(n/2) + 1, otherwise 2*(2*n - k - 3), with T(n, 0) = T(n, n) = 1.
T(2*n, k) = T(2*n, 2*n-k+1).
EXAMPLE
Triangle begins as:
1;
1, 1;
1, 2, 1;
1, 4, 4, 1;
1, 6, 7, 6, 1;
1, 8, 10, 10, 8, 1;
1, 10, 12, 13, 12, 10, 1;
1, 12, 14, 16, 16, 14, 12, 1;
1, 14, 16, 18, 19, 18, 16, 14, 1;
1, 16, 18, 20, 22, 22, 20, 18, 16, 1;
1, 18, 20, 22, 24, 25, 24, 22, 20, 18, 1;
1, 20, 22, 24, 26, 28, 28, 26, 24, 22, 20, 1;
MATHEMATICA
T[n_, k_]:= T[n, k]= If[k==1 || k==n, 1, If[n<4, Binomial[n-1, k-1], If[k==(n+1)/2, 2*(n+k-4) + (-1)^n, If[Floor[n/2]>(k-1), 2*(n+k-4), 2*(2*n-k-3) ]]]];
Table[T[n, k], {n, 15}, {k, n}]//Flatten (* modified by G. C. Greubel, Jan 04 2022 *)
PROG
(Sage)
def T(n, k):
if (k==1 or k==n): return 1
elif (n<4): return binomial(n-1, k-1)
elif (k==(n+1)/2): return 2*(n+k-4) + (-1)^n
elif (k<(n//2)+1): return 2*(n+k-4)
else: return 2*(2*n - k - 3)
[[T(n, k) for k in (1..n)] for n in (1..15)] # G. C. Greubel, Jan 04 2022
CROSSREFS
Sequence in context: A026386 A147532 A283796 * A157528 A132731 A128966
KEYWORD
nonn,tabl
AUTHOR
Roger L. Bagula, Feb 10 2009
EXTENSIONS
Edited by G. C. Greubel, Jan 04 2022
STATUS
approved