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

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

%I #9 Jan 23 2022 07:27:32

%S 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,

%T 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,

%U 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

%N 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.

%H G. C. Greubel, <a href="/A157522/b157522.txt">Rows n = 0..50 of the triangle, flattened</a>

%F 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.

%F From _G. C. Greubel_, Jan 22 2022: (Start)

%F T(n, n-k) = T(n, k).

%F T(2*n, n) = 1.

%F T(2*n+1, n) = A040000(n).

%F Sum_{k=0..n} T(n, k) = A302488(n). (End)

%e Triangle begins as:

%e 1;

%e 1, 1;

%e 1, 1, 1;

%e 1, 2, 2, 1;

%e 1, 3, 1, 3, 1;

%e 1, 3, 2, 2, 3, 1;

%e 1, 3, 3, 1, 3, 3, 1;

%e 1, 3, 4, 2, 2, 4, 3, 1;

%e 1, 3, 5, 3, 1, 3, 5, 3, 1;

%e 1, 3, 5, 4, 2, 2, 4, 5, 3, 1;

%e 1, 3, 5, 5, 3, 1, 3, 5, 5, 3, 1;

%t 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 T[n_, k_]:= f[n,k] +f[n,n-k] -1;

%t Table[T[n, k], {n,0,15}, {k,0,n}]//Flatten (* modified by _G. C. Greubel_, Jan 22 2022 *)

%o (Sage)

%o def f(n, k):

%o if (k <= (n//4)): return k+1

%o elif ((n//4) < k <= (n//2)): return (n//2)-k+1

%o elif ((n//2) < k <= (3*n//4)): return k+1-(n//2)

%o else: return n-k+1

%o def T(n,k): return f(n,k) + f(n,n-k) - 1

%o flatten([[T(n,k) for k in (0..n)] for n in (0..15)]) # _G. C. Greubel_, Jan 22 2022

%Y Cf. A157523.

%K nonn,tabl

%O 0,8

%A _Roger L. Bagula_, Mar 02 2009

%E Edited by _N. J. A. Sloane_, Mar 05 2009