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

Possible Duplicate:
Prove that $n$ is a sum of two squares?

I was reading this and began wondering if there is a general theorem that a number of a given form is the sum of two squares. I know about Fermat's Theorem, but I am thinking about the general case. The question is

For which positive integer $n$ we can find positive integers $a,b$ with $n=a^2+b^2$?

I found a related question: Prove that $n$ is a sum of two squares?

If this is a duplicate, I am sorry. I have searched the site and didn't find this question posted. Any reference would be useful.

share|cite|improve this question

marked as duplicate by Qiaochu Yuan Jun 13 '11 at 16:54

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

See Fermat's theorem on sums of two squares. It has been said that is the result Fermat was most proud of. – lhf Jun 13 '11 at 16:53

The answer is on the page you linked to: $n$ is a sum of two squares if and only if $n$ is a square times a product of different primes which are either 1 modulo 4 or 2.

share|cite|improve this answer
Ok. I'll delete the question. I am sorry I didn't read through the entire post I linked to. – Beni Bogosel Jun 13 '11 at 16:41
@amWhy: The answer is not specific, whatever you mean by this. (One considers the number 1 as the empty product, as is usual, and the emptyset is a part of the set of primes. Ergo.) – Did Jun 13 '11 at 16:54
Perhaps part of the confusion comes from not realizing that every positive integer has a unique decomposition as a square times a product of different primes (product over a possibly empty set of primes). – Did Jun 13 '11 at 16:57

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