If an integer is odd, it is square modulo all powers of $2$ if and only if it is a square modulo $8$ if and only if it is equivalent to $1$ modulo $8$.
How do we determine if an integer $a$ is square modulo all powers of prime, if $a$ is even? I thought that may be factor out all the powers of $4$ and then remaining odd part is if equivalent to $1$ modulo $8$ then we can say that $a$ is square modulo all powers of $2$.
Because powers of $4$ are gonna make up a square and rest (odd part) is going to make square too. So my guess was : $a$ must be of the form $4^{k}(8n+1)$ to be square modulo all powers of $2$.
But I cannot prove that such $a$ are the only integers that can be square modulo all powers of $2$. Any hints?
To be a square modulo all prime powers, $a$ must be a perfect square. Indeed, if $a=p^kr$ where $p\nmid r$ and $k$ is odd, the $a$ is not a square modulo $p^{k+1}$. This leaves us only with number of the form $a=\pm b^2$. But we can also exclude the negative case because $-1$ is not a square modulo many primes not dividing $a$.