Reference: the first $m$ triangular numbers are a complete residue system modulo $m$ iff $m$ is a power of $2$ [duplicate]

Solution 1:

A short proof.

First notice that for any $i, j$, we have $T(i) \equiv T(j) \pmod m \iff 2m\mid (i - j)(i + j + 1)$.

We can write $m = 2^r t$ with $t$ odd.

We take $i = \frac{t + 2^{r + 1} - 1}2$ and $j = \frac{|t - 2^{r + 1}| - 1}2$ and verify that $(i - j)(i + j + 1) = 2^{r + 1}\cdot t = 2m$.

If $t > 1$, then both $i, j$ are in the range $0, \dots, m - 1$ and are different. Therefore $T(0), \dots, T(m - 1)$ cannot be a complete residue system mod $m$.

Now suppose $t = 1$ and hence $m = 2^r$. It suffices to show that, for any $0 \leq j < i < m$, we have $2^{r + 1} \nmid (i - j)(i + j + 1)$.

But the two factors $i - j$ and $i + j + 1$ have different parity, hence one of them is odd; and the other lies in the interval $(0, 2^{r + 1})$. This finishes our proof.