My question is based on an observation made by Vepir in their question "Grasshopper jumping on circles".
Vepir's observation was essentially that the sequence of triangle numbers $T\colon \mathbb{Z} \rightarrow \mathbb{Z}$ $$ T(n) = \frac{n(n+1)}{2} $$ forms a permutation when the inputs are restricted to $\{0,1,\dots,2^k-1\}$ and the outputs are considered $(\text{mod } 2^k)$. Moreover, this only works modulo powers of two.
Example
For example, when $k=3$, the sequence is $$ \begin{alignat*}{8} n: &&\ 0,\ & 1,\ & 2,\ & 3,\ & 4,\ & 5,\ & 6,\ & 7\\ T(n): &&\ 0,\ & 1,\ & 3,\ & 6,\ & 10,\ & 15,\ & 21,\ & 28\\ T(n) \pmod {8}: &&\ 0,\ & 1,\ & 3,\ & 6,\ & 2,\ & 7,\ & 5,\ & 4 \end{alignat*} $$
Question
I showed this to a colleague, and he proved it was a bijection for all $2^m$, however, his proof involved a good deal of case analysis.
Is there a quick and easy way to see that the triangle numbers restrict to a permutation if and only if $k$ is a power of two?
Also, are there examples of polynomials with rational coefficients $f \in \mathbb Q[x]$ that restrict to a permutation if and only if $k$ is a power of three? A power of four? A prime number? A Fibonacci number?