This is some fallout from Fermat's Theorem on the sum of squares and I am just reviewing. I will tag this as proof verification. Let $a,b\in \mathbb{N^+}$
$$\forall x\in \{p\in \mathbb{P}:p|a^2+b^2 \}$$ Where $\mathbb{P}$ is the set of prime numbers.
One of two things can happen either we can say that
1) There exists some $m$ such that $x^{2m}$ divides $a^2+b^2$ but $x^{2m+1}$ does not. That is, $x$ is a prime factor that appears an even number of times.
2) Or we can write $x$ as the sum of squares. That is, $\text{ there exists integers } a_x,b_x \text{ such that } x=a_x^2+b_x^2$
That is, $$a^2+b^2= p_1^{e_1} p_2^{e_2} \dots p_j^{e_j} \rho_1^{\epsilon_1}\rho_2^{\epsilon_2} \dots \rho_k^{\epsilon_k}$$
Where $p_1, p_2, \dots p_j $ are unique primes that can be written as the sum of squares and where $\rho_1, \rho_2, \dots \rho_k$ are unique primes that cannot be written as the sum of squares and $\epsilon_1, \epsilon_2, \dots \epsilon_k$ are even numbers.
Let's look at a simple case and then we'll tackle a proof: Say we look at $15^2+57^2=3474$. This has the prime factors $2,3,193$. $$2=1^2+1^2$$ $$3^2 \text{ divides }3474 \text{ but } 3^3 \text{ does not divide } 3474$$ $$193=7^2+12^2$$
Now let's see the big picture... We will need a few lemmas which I may or may not prove but today I will focus on the highlevel.
The wording of the following lemmata were taken from [1]. The corollary was not.
Lemma 1 The product of two numbers, each of which is a sum of two squares, is itself a sum of two squares.
Lemma 2 *If a number which is a sum of two squares is divisible by a prime which is a sum of two squares, then the quotient is a sum of two squares. (This is Euler's first Proposition).
Lemma 3 If a number which can be written as a sum of two squares is divisible by a number which is not a sum of two squares, then the quotient has a factor which is not a sum of two squares. (This is Euler's second Proposition).
Corollary to Lemma 3 If a number which can be written as a sum of two squares is divisible by a number which is not a sum of two squares then the number is not prime.
Proof
This number $m$ is divisible by a number $n$ which cannot be $1$ (as $1$ can be written as the sum of squares) or itself. We know $m\neq n$ because $m$ can be written as the sum of squares but $n$ cannot. Therefore $m$ is not prime.
Claim
$$\forall x\in \{p\in \mathbb{p} :p|a^2+b^2 \} $$
If $x$ doesn't have 'even multiplicity' in $a^2+b^2$ then there exists integers $a_x,b_x$ such that $x=a_x^2+b_x^2$. In other words
$$a^2+b^2= p_1^{e_1} p_2^{e_2} \dots p_j^{e_j} \rho_1^{\epsilon_1}\rho_2^{\epsilon_2} \dots \rho_k^{\epsilon_k}$$
Where $p_1, p_2, \dots p_j $ are unique primes that can be written as the sum of squares and where $\rho_1, \rho_2, \dots \rho_k$ are unique primes that cannot be written as the sum of squares and $\epsilon_1, \epsilon_2, \dots \epsilon_k$ are even numbers.
Proof
We now will with the help of a function $g$ categorize the primes into "good apples" and "bad apples". We define $g:\mathbb{P} \rightarrow \{0,1\}$ such:
$$ g(p)= \begin{cases} 1 \text{ When $p$ can be written as the sum of squares. } \\ 0 \text{ When $p$ cannot be written as the sum of squares. } \end{cases} $$
Write $$a^2+b^2= p_1^{e_1} p_2^{e_2} \dots p_j^{e_j} \rho_1^{\epsilon_1}\rho_2^{\epsilon_2} \dots \rho_k^{\epsilon_k}$$ where $g(p_i)=1$ and $g(\rho_i)=0$. We need to see that $\epsilon_i$ is always even.
Then in this notation we have $$ \prod_{i\in [j]}{p_i^{e_i}} \prod_{ i\in [k] }{\rho_i^{\epsilon_i}} =x$$ and thereby (collecting our bad apples on the lefthandside) $$ \prod_{ i\in [k] }{\rho_i^{\epsilon_i}} = \frac{x}{\prod_{i\in [j]}{p_i^{e_i}}} $$
Then $\prod_{ i\in [k] }{\rho_i}$ can be written as the sum of two squares. This follows from lemmas 1 and 2. That is only possible when there exists some $c$ $$\prod_{ i\in [j] }{\rho_i^{\epsilon_i}} = 0^2+ c^2=c^2$$
Assume by way of contradiction that some of these epsilon are odd. Note that when $\epsilon_i$ is even we can write $\rho_i^{\epsilon_i}=0^2+(\rho_i^{\epsilon_i/2})^2$ as the sum of squares. So we will divide these sums of squares out:
$$ \prod_{ i\in [k] }{\rho_i^{\epsilon_i}} = \frac{x}{\prod_{i\in [j]}{p_i^{e_i}}} $$ Implies that $$ \prod_{ 2\nmid \epsilon_i }{\rho_i^{\epsilon_i}} = \frac{x}{\prod_{i\in [j]}{p_i^{e_i}}\prod_{ 2 | \epsilon_i }{\rho_i^{\epsilon_i}} } $$
Now we have that this must be the sum of squares and it's a product of primes (which cannot be written as the sum of squares) raised to odd powers. So let's write $\epsilon_i= 2\mu_i+1$ and we will divide out $\prod{\rho_i^{2\mu_i}}$ as well. That is,
$$ \prod_{2\nmid \epsilon_i}{\rho_i} = \frac{x} {\prod_{2\nmid \epsilon_i}{\rho_i^{2{\mu_i}}} \prod_{i\in [j]}{p_i^{e_i}}\prod_{ 2 | \epsilon_i }{\rho_i^{\epsilon_i}}} $$
And now we are in a position to use my corollary. We can see that the left hand side of the equation can be written as the sum of squares by lemmas 1 and 2 and then for each $\rho_i$ where $\epsilon_i$ is not even we find that $\rho_i$ is a number which cannot be written as the sum of squares and divides a number which is the sum of squares and by the corollary this means that $\rho_i$ is not prime. But that's a contradiction. We got this contradiction by assuming that some of the epsilon were odd. That completes the proof. $\square$
Works Cited
[1] [Proof of Fermat's Theorem on the sum of squares. ] https://www.wikiwand.com/en/Proofs_of_Fermat%27s_theorem_on_sums_of_two_squares