Problem:
Let $$ {S_m} = \left\{ \left[ \frac{k(k+1)}{2} \right]_{\pmod{m}} \mid k \in \mathbb{N} \right\}.$$ Show that $ S_m = \mathbb{Z}_m $ if and only if $ m = 2^s $ for some $ s \in \mathbb{N}.$
Attempted solution:
First we observe that for each prime $ p > 2 $ there exists a $ b \in \mathbb{Z_p} $ such that $ x^2 = b \pmod{p}$ has no solutions.
So $m$ can't be a prime, which is excluded if $ m = 2^s $. Now I'm stuck, I don't know how to approach this problem. Any hints?
Muchos gracias!