If $a \in \Bbb Z$ is the sum of two squares then $a$ can't be written in which of the following forms? [duplicate]

Let $a \in \Bbb Z$ be such that $a = b^2 + c^2,$ where $b,c \in \Bbb Z \setminus \{0\}.$ Then $a$ cannot be written as $:$

$(1)$ $p d^2,$ where $d \in \Bbb Z$ and $p$ is a prime with $p \equiv 1\ \left (\text {mod}\ 4 \right ).$

$(2)$ $p q d^2,$ where $d \in \Bbb Z$ and $p,q$ are distinct primes with $p,q \equiv 3\ \left (\text {mod}\ 4 \right ).$

$(1)$ is false because $2^2 + 1^2 = 5 = 5 \cdot 1^2,$ where $d = 1 \in \Bbb Z$ and $5$ is a prime with $5 \equiv 1\ \left (\text {mod}\ 4 \right ).$ How do I prove or disprove the other option? Any help in this regard will be appreciated.

Thanks for your time.


Solution 1:

Note the Sum of two squares theorem states

An integer greater than one can be written as a sum of two squares if and only if its prime decomposition contains no term $p^k$, where prime $p\equiv 3 \pmod{4}$ and $k$ is odd.

For your $(2)$, with $p$, since it's distinct from $q$, then the power of $p$ in $a$ would be $1$ plus $2$ times the power of $p$ in $d$, i.e., the exponent of $p$ is odd. Thus, since $p \equiv 3 \pmod{4}$, then the theorem quoted above says the value cannot be the sum of two squares.


Note the Wikipedia's article's proof link to the Internet Archive says "This item is no longer available". I did some searching, but couldn't find any other link to it. However, there's basically the equivalent theorem stated in Sum of Two Squares near the bottom of page $4$:

Theorem $6$. A positive integer n is a sum of two squares iff $\operatorname{ord}_p(n)$ is even for all primes $p \equiv 3 \pmod{4}$.

It then follows with a remark about an equivalent statement (which is also equivalent to Wikipedia's theorem statement I quoted initially):

Remark: An equivalent statement of the theorem, which we will use in the proof, is: $n$ is a sum of two squares iff it factors as $n = ab^2$, where $a$ has no prime factor $p \equiv 3 \pmod{4}$.

This statement is possibly somewhat confusing as it's basically the equivalent of saying $a$ is square-free. Anyway, the linked paper goes on to state & prove a lemma it then uses to prove its theorem $6$.

Solution 2:

There already is an accepted answer, but I wanted to point out a more self-contained argument. A way to prove 2) is to use the following elementary lemma: if $p=3$ mod $4$ is a prime and $a,b$ are integers such that $p|a^2+b^2$, then $p|a$ and $p|b$, thus $p^2|a^2+b^2$.

This lemma implies that for any prime $p=3$ mod $4$ and any integers $a,b$, $v_p(a^2+b^2)$ is even, which shows 2).

Now, how to prove the lemma?

Assume we have $p|a^2+b^2$ and, say, $p$ does not divide $a$. Let $a'$ be its inverse mod $p$; take $b'=ba'$. Then $p|b'^2+1$. As $\frac{p-1}{2}$ is odd, $(b')^2+1|(b')^{2\times (p-1)/2}+1$, so $p|(b')^p+b'$. But by Fermat's little theorem, $p|(b')^p-b'$ so $p|2b'$. As $p \neq 2$, $p|b'$, so (as $a'$ is coprime to $p$) $p|b$. Therefore $p|a^2$ so $p|a$, a contradiction.