OFFSET
1,1
LINKS
G. C. Greubel, Rows n = 1..100 of antidiagonals, flattened
FORMULA
T(n,k) = {nx} + {kx} - {nx+kx}, where x=sqrt(2) and { } denotes fractional part;, i.e., {r} = r - Floor(r).
T(k, n) = floor(n*r + k*r) - floor(n*r) - floor(k*r), with r = sqrt(2). - G. C. Greubel, May 30 2019
EXAMPLE
Northwest corner:
0 1 0 1 0 0 1 0 1
1 1 1 1 0 1 1 1 1
0 1 0 0 0 0 1 0 0
1 1 0 1 0 1 1 0 1
0 0 0 0 0 0 0 0 0
0 1 0 1 0 0 1 0 1
T(3,3)=0 because 2{3x}-{6x}=0.
The antidiagonals form a triangle with these first six rows:
0
1 1
0 1 0
1 1 1 1
0 1 0 1 0
0 0 0 0 0 0
MATHEMATICA
r:= Sqrt[2];
T[k_, n_] := Floor[n*r + k*r] - Floor[n*r] - Floor[k*r];
TableForm[Table[T[n, k], {k, 1, 5}, {n, 1, 5}]]
Table[T[n-k+1, k], {n, 1, 12}, {k, 1, n}] (* G. C. Greubel, May 30 2019 *)
PROG
(PARI) r=sqrt(2);
T(n, k) = ((n+k)*r)\1 - (n*r)\1 - (k*r)\1;
for(n=1, 10, for(k=1, n, print1(T(n-k+1, k), ", "))) \\ G. C. Greubel, May 30 2019
(Magma) r:=Sqrt(2); [[Floor((n+1)*r)-Floor((n-k+1)*r)-Floor(k*r): k in [1..n]]: n in [1..10]]; // G. C. Greubel, May 30 2019
(Sage)
r=sqrt(2);
def T(n, k): return floor((n+k)*r)-floor(n*r)-floor(k*r)
[[T(n-k+1, k) for k in (1..n)] for n in (1..12)] # G. C. Greubel, May 30 2019
CROSSREFS
KEYWORD
nonn,tabl
AUTHOR
Clark Kimberling, Jan 01 2007
STATUS
approved