OFFSET
1,5
LINKS
G. C. Greubel, Rows n = 1..50 of the triangle, flattened
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
KEYWORD
nonn,tabl
AUTHOR
Roger L. Bagula, Feb 10 2009
EXTENSIONS
Edited by G. C. Greubel, Jan 04 2022
STATUS
approved