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&-1&-1&-1&-1&0&0&0&0&0&0&0&0&0&\\-18&-8&-8&-3&-3&-3&-3&-1&-1&-1&-1&-1&-1&-1&-1&0&0&0&0&0&0&0&0&0&\\-19&-9&-9&-4&-4&-4&-4&-1&-1&-1&-1&-1&-1&-1&-1&0&0&0&0&0&0&0&0&0&\\-20&-9&-9&-4&-4&-4&-4&-1&-1&-1&-1&-1&-1&-1&-1&0&0&0&0&0&0&0&0&0&\\-21&-10&-10&-4&-4&-4&-4&-1&-1&-1&-1&-1&-1&-1&-1&0&0&0&0&0&0&0&0&0&\\-22&-10&-10&-4&-4&-4&-4&-1&-1&-1&-1&-1&-1&-1&-1&0&0&0&0&0&0&0&0&0&\\-23&-11&-11&-5&-5&-5&-5&-2&-2&-2&-2&-2&-2&-2&-2&0&0&0&0&0&0&0&0&0&\\ \end{pmatrix}
there are blocks of sizes of powers of $2$, then consecutive numbers appear $2^i$ times, where $i$ is the current number of bits in the row number.
Any idea how to obtain a closed form or recursive expression for $M_{i,j}$? It is obvious that $M_{i,j} = -M_{j,i}$.
The closed form can be obtained as follows: For $i\leq j$ it is:
$$ M_{i,j} = \left\lfloor\frac{j}{2^{\left\lfloor \log_2(i)\right\rfloor}}\right\rfloor - 1 $$
and $M_{i,j}=-M_{j,i}$ for $i>j$.