So immediately I just want to say that all these integers n must themselves be squares. Then, I know the following from class:

  1. primes that are the sums of two squares are 1 (mod 4)
  2. n, an integer, is the sum of two squares if it's prime factorization has primes congruent congruent to 3 (mod 4) occurring only with even powers
  3. products of sums of two squares are also the sums of two squares
  • 1
    $\begingroup$ You want $n=x^2+y^2$ and $n=z^2$, right? So we have all Pythagorean triples. $\endgroup$ Nov 16, 2019 at 20:05
  • 1
    $\begingroup$ wrong @Dieterich we want $$n=x^2+y^2\land (x=0\lor y=0)$$ $\endgroup$
    – user645636
    Nov 16, 2019 at 22:28

1 Answer 1


Let $n=x^{2}+y^{2}$ be such an integer. if $x \neq 0$ and $y \neq 0$ we have a contradiction. So we may assume that $y = 0$.

Therefore $n = x^{2}$.$ \ $ Hence $n$ is a square.

Assume $n>1$, since $n$ can't be written as as the sum of two nonzero squares, all of its odd prime factors must be $3$ mod $4$.

If not, assume $p | n$ and $p = 1 $ mod $4$

Then we may write:$ \ \ \ p=a^{2}+b^{2} \Rightarrow p^2 = (a^{2}-b^{2})^{2}+(2ab)^{2}.$

$n = \frac{x^{2}}{p^{2}} p^{2} = [\frac{x}{p}(a^{2}-b^{2})]^{2}+[\frac{x}{p}(2ab)]^{2}$ which is the sum of 2 non-zero squares.

Therefore $n$ is either $0, 1$ or a number of the form: $\ \ \ \ 2^{2k}\prod_{ì=1}^{s}p_{i}^{2k_{i}},$

Where each $p_{i}$ is $3$ mod $4$.

On the other hand, if $n$ can be written in such a way, and $ \ n = x^{2}+y^{2}$,

$\Rightarrow n = (x + yi)(x-yi)$, By unique factorization of $\mathbb{Z}[i]$, there are 2 cases to consider:

Either one of the $p_{i}$ would factor non trivially in $\mathbb{Z}[i]$, but it doesn't as $p_{i}$ is $3$ mod $4$.

The only other possibility is that $\ \ 2^{2k}=a^{2}+b^{2}, \ a \neq 0, \ b \neq 0$

but you can check that this is not possible by taking congruences mod $4$.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.