Given a prime $p\equiv 1\pmod 4$, Fermat's two-squares theorem discovered by Girard states that there exists two integers $A,B$ such that $p=A^2+B^2$.
For all primes up to $10^7$ the integers $A$ and $B$ are squares modulo $p$ if $p\equiv 1\pmod 8$ and they are fourth powers modulo $p$ if $p\equiv 1\pmod {16}$. This pattern breaks then down: $A$ and $B$ are not necessarily $8$-th powers modulo $p$ for primes $p\equiv 1\pmod{32}$.
Is there an explanation (proof or reference) for these observations? Is there an explanation why they fail to carry on?
Details: We start with $p=A^2+B^2\equiv 1\pmod{4}$. Since we have obviously $(A/B)^2\equiv -1\pmod p$ this implies that $\left(\frac{AB}{p}\right)=(-1)^{(p-1)/4}$ with $\left(\frac{x}{p}\right)$ denoting the Jacobi-symbol (which equals $1$ on non-zero squares and $-1$ on non-squares in $\mathbb F_p$).
This shows that $\left(\frac{A}{p}\right)=\left(\frac{B}{p}\right)$ if $p\equiv 1\pmod 8$. Surprisingly, negative Jacobi-symbols do not occur for small primes and we have $\left(\frac{A}{p}\right)=\left(\frac{B}{p}\right)=1$ for all 165976 primes $p\equiv 1\pmod 8$ up to $10^7$.
Given a prime $p=A^2+B^2\equiv 1\pmod 8$ with $\left(\frac{A}{p}\right)=\left(\frac{B}{p}\right)=1$ we can choose square roots $a,b$ of $A\equiv a^2\pmod p$ and $B\equiv b^2\pmod p$. We have then $(ab^{-1})^4\equiv -1\pmod p$ which shows $\left( \frac{ab}{p}\right)\equiv (-1)^{(p-1)/8}$ and we get therefore $\left(\frac{a}{p}\right)=\left(\frac{b}{p}\right)$ if $p\equiv 1\pmod{16}$. (The choice of initial signs for $A,B$ and the choice between the two possible square-roots for $a$ or $b$ do not change the values of the Jacobi-symbols.)
We get again $\left(\frac{a}{p}\right)=\left(\frac{b}{p}\right)=1$ for all 82967 primes $p\equiv 1\pmod{16}$ up to $10^7$ and we can then choose square roots $\alpha,\beta$ of $a\equiv \alpha^2\pmod{p}$ and $b\equiv \beta^2\pmod{p}$ (or, equivalently, fourth-roots of $A\equiv \alpha^4\pmod p$ and $B\equiv \beta^4\pmod p$ where $p=A^2+B^2\equiv 1\pmod{16}$). We have again $\left(\frac{\alpha\beta}{p}\right)=(-1)^{(p-1)/16}$.
We have therefore $\left(\frac{\alpha}{p}\right)=\left(\frac{\beta}{p}\right)$ if $p\equiv 1\pmod{32}$.
The pattern observed experimentally above breaks down at this point. We have for example
$193=7^2+12^2$ with $83^4\equiv 7\pmod{193},\ 75^4\equiv 12\pmod{193}$ and $\left(\frac{83}{193}\right)=\left(\frac{75}{193}\right)=1$,
$673=12^2+23^2$ with $194^4\equiv 12\pmod{673},\ 206^4\equiv 23\pmod{673}$ and $\left(\frac{194}{673}\right)=\left(\frac{206}{673}\right)=1$
but we have
$97=4^2+9^2$ with $14^4\equiv 4\pmod{97},\ 10^4\equiv 9\pmod{97}$ and $\left(\frac{14}{97}\right)=\left(\frac{10}{97}\right)=-1$,
$1153=8^2+33^2$ with $425^4\equiv 8\pmod{1153},\ 269^4\equiv 33\pmod{1153}$ and $\left(\frac{425}{1153}\right)=\left(\frac{269}{1153}\right)=-1$.
(More precisely, there are 41453 primes congruent to $1\pmod {32}$ up to $10^7$. These primes yield 20613 times $\left(\frac{\alpha}{p}\right)=\left(\frac{\beta}{p}\right)=1$. Both Jacobi-symbols are equal to $-1$ for the remaining 20840 primes congruent to $1\pmod{32}$ up to $10^7$.)