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

A157522
Triangle T(n, k) = f(n, k) + f(n, n-k) - 1, where f(n, k) = k if k <= floor(n/4), floor(n/2) - k if floor(n/4) < k <= floor(n/2), k - floor(n/2) if floor(n/2) < k <= floor(3*n/4), otherwise n-k, read by rows.
2
1, 1, 1, 1, 1, 1, 1, 2, 2, 1, 1, 3, 1, 3, 1, 1, 3, 2, 2, 3, 1, 1, 3, 3, 1, 3, 3, 1, 1, 3, 4, 2, 2, 4, 3, 1, 1, 3, 5, 3, 1, 3, 5, 3, 1, 1, 3, 5, 4, 2, 2, 4, 5, 3, 1, 1, 3, 5, 5, 3, 1, 3, 5, 5, 3, 1, 1, 3, 5, 6, 4, 2, 2, 4, 6, 5, 3, 1, 1, 3, 5, 7, 5, 3, 1, 3, 5, 7, 5, 3, 1, 1, 3, 5, 7, 6, 4, 2, 2, 4, 6, 7, 5, 3, 1
OFFSET
0,8
FORMULA
T(n, k) = f(n, k) + f(n, n-k) - 1, where f(n, k) = k if k <= floor(n/4), floor(n/2) - k if floor(n/4) < k <= floor(n/2), k - floor(n/2) if floor(n/2) < k <= floor(3*n/4), otherwise n-k.
From G. C. Greubel, Jan 22 2022: (Start)
T(n, n-k) = T(n, k).
T(2*n, n) = 1.
T(2*n+1, n) = A040000(n).
Sum_{k=0..n} T(n, k) = A302488(n). (End)
EXAMPLE
Triangle begins as:
1;
1, 1;
1, 1, 1;
1, 2, 2, 1;
1, 3, 1, 3, 1;
1, 3, 2, 2, 3, 1;
1, 3, 3, 1, 3, 3, 1;
1, 3, 4, 2, 2, 4, 3, 1;
1, 3, 5, 3, 1, 3, 5, 3, 1;
1, 3, 5, 4, 2, 2, 4, 5, 3, 1;
1, 3, 5, 5, 3, 1, 3, 5, 5, 3, 1;
MATHEMATICA
f[n_, k_]= 1 +If[k<=Floor[n/4], k, If[Floor[n/4]<k<=Floor[n/2], Floor[n/2]-k, If[Floor[n/2]<k<=Floor[3*n/4], k-Floor[n/2], n-k]]];
T[n_, k_]:= f[n, k] +f[n, n-k] -1;
Table[T[n, k], {n, 0, 15}, {k, 0, n}]//Flatten (* modified by G. C. Greubel, Jan 22 2022 *)
PROG
(Sage)
def f(n, k):
if (k <= (n//4)): return k+1
elif ((n//4) < k <= (n//2)): return (n//2)-k+1
elif ((n//2) < k <= (3*n//4)): return k+1-(n//2)
else: return n-k+1
def T(n, k): return f(n, k) + f(n, n-k) - 1
flatten([[T(n, k) for k in (0..n)] for n in (0..15)]) # G. C. Greubel, Jan 22 2022
CROSSREFS
Cf. A157523.
Sequence in context: A353468 A184305 A337279 * A059674 A367624 A342748
KEYWORD
nonn,tabl
AUTHOR
Roger L. Bagula, Mar 02 2009
EXTENSIONS
Edited by N. J. A. Sloane, Mar 05 2009
STATUS
approved