Prove that $a$, where $0 \leq a < 2^n$, is a quadratic residue modulo $2^n$ is odd if and only if $a = 4^m(1+8k)$ for some nonnegative integers $m,k$.
If $a$ is odd we have $r^2 \equiv a \pmod{2^n}$ where $r = 1+2k$. Then $$r^2 = (1+2k)^2 = 1+4k+4k^2 = 1+4k(1+k).$$ If $k$ is even then $1+4k(1+k) = 1+8\left(\frac{k}{2}\right)(1+k)$. How do we continue? We also have the case where $r^2 \geq 2^n$. How do we continue?