Consider, for any $n\in\mathbb{Z}$, the $n$th-triangular number $T_{n}=\frac{n(n+1)}{2}$. I just noticed that, for $m\in\mathbb{N}\setminus\{0,1\}$, $$T_{0}, T_{1}, ... , T_{m-1}$$ is a complete residue system modulo $m$ (meaning, as it always does, that for every $i\in\{1, 2,... , m\}$ there exists $j$ on the same set such that $T_{j}\equiv i$ modulo $m$) if, and only if, $m$ is a power of $2$.
Just for illustration:
- for $m=2$, $T_{0}=0\equiv 0$ and $T_{1}=1\equiv 1$;
- for $m=3$, $T_{0}\equiv 0$, $T_{1}\equiv 1$, and $T_{2}=3\equiv 0$;
- for $m=4$, $T_{0}\equiv 0$, $T_{1}\equiv 1$, $T_{2}\equiv 3$, $T_{3}=6\equiv 2$;
- for $m=5$, $T_{0}\equiv 0$, $T_{1}\equiv 1$, $T_{2}\equiv 3$, $T_{3}\equiv 1$ and $T_{4}=10\equiv 0$;
- and so on...
I am not a number theorist, so the proof I was able to come up with for this fact is not straightforward and very long... What would be a standard, preferably short proof of this? And can it be easily generalized to pentagonal numbers, hexagonal numbers and so on?