<s>[INST] Questions about $(\mathbb{Z}/2^n\mathbb{Z})^{\times}$ We have $(\mathbb{Z}/2^n\mathbb{Z})^{\times}$ is a group with $\varphi(2^n)=2^{n-1}$ elements. Prove that $x^2=1$ has exactly four solutions in $\mathbb{Z}/2^n\mathbb{Z}$. Moreover, can we show that     $q$ is a perfect square in $(\mathbb{Z}/2^n\mathbb{Z})^{\times}$ if and only if $q=8k+1$ for some integer $k$. It is well known that $o_{2^n}(5)=2^{n-2}$, but can we strenghten this to $o_{2^n}(3)=o_{2^n}(5)=2^{n-2}$? Furthermore which elements of $(\mathbb{Z}/2^n\mathbb{Z})^{\times}$ are expressible as a power of $3$? What about a power of $5$. Any help is greatly appreciated.
 [/INST] For the first question, we need $n\ge 3$. We show that there are precisely $4$ integers $x$ between $0$ and $2^n-1$ such that $x^2\equiv 1\pmod{2^n}$, that is, such that $2^n$ divides $(x-1)(x+1)$.
Note that if $a$ and $b$ are two consecutive even integers, then one of them is congruent to $2$ modulo $4$.
Suppose that $2^n$ divides $(x-1)(x+1)$, and $x+1$ is of the shape $4k+2$. Then  $2^{n-1}$ must divide $x-1$. Since we can take $0\le x\le 2^n-1$, it follows that $x=1$ or $x=2^{n-1}+1$.
Suppose that $2^n$ divides $(x-1)(x+1)$ and $x-1$ is of the shape $4k+2$. Then $2^{n-1}$ divides $x+1$, and therefore the only possibilities between $0$ and $2^{n}-1$ are $2^n-1$ and $2^{n-1}-1$.
If $n\ge 3$, the $4$ possibilities we have listed are distinct.
Now we look at the second question, and sketch a proof of the fact that (again when $n\ge 3$), $a$ is a quadratic residue modulo $2^n$ if and only if $a$ is of the form $8k+1$.
Since the quadratic residues modulo $8$ are $0$, $1$, and $4$ any odd square is of the form $8k+1$, so numbers of the form $8k+3$, $8k+5$, and $8k+7$ cannot be quadratic residues of $2^n$.
Define the function $f(x)$ on the odd positive integers $\lt 2^n$ as the remainder when $x^2$ is divided by $2^n$. By our count of the solutions of $x^2\equiv 1\pmod{2^n}$, $f(x)$ is $4$ to $1$.  Thus there must be $2^{n-3}$ quadratic residues. But the only candidates have shape $8k+1$. Since there  are only $2^{n-3}$ of these, they must all be quadratic residues.
</s>