prove that if an odd prime p divides $a_n, 2^{n+3} | p^2 - 1$ 
A past problem and its solution are shown below. For an answer, it's fine if an alternative solution is provided, though it might be significantly easier to answer the four questions below instead.


*

*In the solution, why exactly does "the claim together with the previous observation" imply that the minimal r with $((1+\sqrt{3})a_{n-1})^r - 1\in I $ equals $2^{n+3}$? Clearly one can't have $((1+\sqrt{3})a_{n-1})^{2^r} -1\in I$ for some $r < n+3.$ Let $A = ((1+\sqrt{3})a_{n-1})$. Is this because if you write $2^{n+3} = rq + r_2, 0\leq r_2 < r$, then $A^{2^{n+3}} - 1\in I$ and $A^r - 1\in I$ implies $A^{r_2} - 1\in I$ so that $r$ divides $2^{n+3}$ and hence $r$ must be a power of $2$?

*Why does the claim imply that the map $f$ is bijective?

*Why does $\prod_{x\in S} x = \prod_{x\in S} f(x)$ imply that $\prod_{x\in S} (((1+\sqrt{3}) a_{n-1})^{p^2-1} - 1)\in I$?

*Why does the claim imply $A^{p^2 - 1} - 1 \in I$?


 A: Let us denote $x-y\in I$ by $x\equiv y\pmod I$.

*

*Yes.

Let $r'=\gcd(r, 2^{n+3}).$ Then there exists integers $c_1, c_2$ such that $c_1r+c_22^{n+3}=r'$.
$$A^{r'}=A^{c_1r+c_22^{n+3}}=\left(A^r\right)^{c_1}\left(A^{2^{n+3}}\right)^{c_2}\equiv1^{c_1}1^{c_2}=1 \pmod I$$
Since $r'$ is a factor of $2^{n+3}$, $r'=2^k$ for some $k\le n+3$.
If $k\le n+2$, $A^{2^{n+2}}=\left(A^{2^{k}}\right)^{2^{n+2-k}}\equiv1^{2^{n+2-k}}=1\pmod I$, which contradicts with $A^{2^{n+2}}\equiv1^{2^{n+2-k}}=-1\pmod I$, since $p$ is odd.
The contradiction above means that $k=n+3$.


*The claim implies that there is $A'\in S$ such that $A'A\equiv 1\pmod I$.

Define $f$ by $f(x)= (g\% p)+(h\%p)\sqrt3$ where $xA=g+h\sqrt3$ from some integer $g$ and $h$, $~\%~$ is the integer remainder operation, i.e.,$g\%p$ is the unique integer between $0$ and $p-1$ such that the difference between it and $g$ is a multiple of $p$.
Note that $f(x)\equiv xA\pmod I$.
If $x\in S$, then $f(x)A'\equiv xAA'\equiv x\cdot1=1\pmod I$, which implies $f(x)\not=0$. Hence $f$ maps $S$ to $S$.
Suppose $Ax\equiv Ay\pmod I$ for some $x, y\in S$. Then $x=1\cdot x\equiv A'Ax\equiv A'Ay\equiv1\cdot y = y.$ Hence $f$ is injective.
Since $f$ is an injective map from the finite set $S$ to itself, $f$ must be bijective from $S$ to $S$.


*$$\prod_{x\in S} x = \prod_{x\in S} f(x)\equiv\prod_{x\in S} (xA)=\prod_{x\in S}x~\prod_{x\in S}A=(\prod_{x\in S}x)~A^{|S|}=(\prod_{x\in S}x)~A^{p^2-1}\pmod I $$
which means $(\prod_{x\in S} x)-(\prod_{x\in S}x)~A^{p^2-1}=(\prod_{x\in S}x) (A^{p^2-1} - 1)\in I$


*For each $x\in S$, let $x'$ be the element in $S$ such that $xx'\equiv1\pmod I$, as guaranteed by the claim.
$(\prod_{x\in S}x')(\prod_{x\in S}x) (A^{p^2-1} - 1)=(\prod_{x\in S}(xx'))(A^{p^2-1} - 1)\equiv(\prod_{x\in S}1) (A^{p^2-1} - 1)=1(A^{p^2-1} - 1)=A^{p^2-1} - 1$
Since $(\prod_{x\in S}x) (A^{p^2-1} - 1)\in I$, the left-hand side of the equation above is in $I$. So is the right-hand side.
