login
A332104
Triangle read by rows in which row n >= 0 lists numbers from 0 to n starting at floor(n/2) and using alternatively larger respectively smaller numbers than the values used so far.
1
0, 0, 1, 1, 0, 2, 1, 2, 0, 3, 2, 1, 3, 0, 4, 2, 3, 1, 4, 0, 5, 3, 2, 4, 1, 5, 0, 6, 3, 4, 2, 5, 1, 6, 0, 7, 4, 3, 5, 2, 6, 1, 7, 0, 8, 4, 5, 3, 6, 2, 7, 1, 8, 0, 9, 5, 4, 6, 3, 7, 2, 8, 1, 9, 0, 10, 5, 6, 4, 7, 3, 8, 2, 9, 1, 10, 0, 11, 6, 5, 7, 4, 8, 3, 9, 2, 10, 1, 11, 0, 12
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
If columns are indexed starting from 0:
T(n,0) = floor(n/2) = A004526(n).
T(n,n-2*k) = n-k, for k >= 0.
T(n,n-2*k-1) = k, for k >= 0.
T(n,k) = floor((n+(-1)^(n-k)*k)/2) = (n+k)/2 if n+k even, otherwise floor((n-k)/2).
a(n) = |A128180(n)| - 1.
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
Cf. A196199 (concatenate [-n .. n] for n=0, 1, 2...).
Cf. |A128180| = A209279 (based on a very similar idea with positive integers instead).
Sequence in context: A271484 A199920 A177995 * A238735 A356006 A258120
KEYWORD
nonn,tabl
AUTHOR
M. F. Hasler, May 30 2020
STATUS
approved