OFFSET
0,6
COMMENTS
The idea is to cover the range 0..n starting from the center and approaching the limiting values in the most symmetric way, using the smaller value in case of a tie, which leads to each row ending in (the first occurrence of) n.
Contains any sequence of nonnegative integers as a subsequence.
FORMULA
EXAMPLE
The table starts:
Row 0: 0;
Row 1: 0, 1;
Row 2: 1, 0, 2;
Row 3: 1, 2, 0, 3;
Row 4: 2, 1, 3, 0, 4;
Row 5: 2, 3, 1, 4, 0, 5;
Row 5: 3, 2, 4, 1, 5, 0, 6;
Row 6: 3, 4, 2, 5, 1, 6, 0, 7;
Row 7: 4, 3, 5, 2, 6, 1, 7, 0, 8;
Row 8: 4, 5, 3, 6, 2, 7, 1, 8, 0, 9;
Row 9: 5, 4, 6, 3, 7, 2, 8, 1, 9, 0, 10;
Row 10: 5, 6, 4, 7, 3, 8, 2, 9, 1, 10, 0, 11; ...
Column 1 is floor(n/2) = A004526(n).
The "diagonal" (last element of each row) are the nonnegative integers A001477.
The first subdiagonal is the zero sequence A000004.
The second subdiagonal is the set of positive integers A000027.
The third subdiagonal is "all ones" sequence A000012.
And so on: in alternance, every other subdiagonal is the set of integers >= k, resp., k times the all ones sequence.
MATHEMATICA
Table[Floor[(n + (-1)^(n - k)*k)/2], {n, 0, 12}, {k, 0, n}] // Flatten (* Michael De Vlieger, Jul 03 2020 *)
PROG
(PARI) row(n)={ my(m=n\2, M=m, r=[m]); while(#r <= n, r=concat(r, if( n-M > m, M+=1, m-=1))); r}
(PARI) T(n, k)=(n+(-1)^(n-k)*k)\2
CROSSREFS
KEYWORD
nonn,tabl
AUTHOR
M. F. Hasler, May 30 2020
STATUS
approved