Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top


If $p$ is a prime where $p \equiv 3 \pmod{4}$ then $p$ can't be written as the sum of two numbers squared.

I attempted by contradiction, supposing that $p=a^2 + b^2$ where $a,b$ are integers. From definitions i got down to $4$ must divide $a^2 + b^2 - 3$ (since $p=a^2 + b^2\equiv 3 \pmod{4} )$ but I am unsure why this is (or leads to) a contradiction.

share|cite|improve this question

We have that $p\equiv 3 \mod 4$, thus $p=4k+3$. Now, modulo $4$ we have that the squares are $$0^2=0\\1^2=1\\2^2=0\\3^2=1$$

But then $$a^2+b^2=0,1,2\mod 4$$

That is, any sum of squares cannot be $\equiv 3\mod 4$. Note that $p$ being prime is irrelevant!

share|cite|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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