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.
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
Examples
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.
Crossrefs
Programs
-
Mathematica
Table[Floor[(n + (-1)^(n - k)*k)/2], {n, 0, 12}, {k, 0, n}] // Flatten (* Michael De Vlieger, Jul 03 2020 *)
-
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
Comments