# Can 2017 be written uniquely as a sum of 2 squares? [duplicate]

This question already has an answer here:

I know that $2017 = 9^2+44^2$, but how can I prove that this is the only possible way you can write 2017 as a sum of 2 squares?

## marked as duplicate by Namaste, apnorton, Lord Shark the Unknown, Glorfindel, dantopaJul 12 '17 at 21:26

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.

• if you are unfamiliar with advanced number theory topics such as Gaussian integers, then brute force checking is pretty much the only way to convince yourself. – dezdichado Jul 12 '17 at 19:59
• observation by Euler, having more than one expression means the number is composite. Article by Brillhart, December 2009, A Note on Euler's Factoring Problem – Will Jagy Jul 12 '17 at 20:01
• It is quite quick to check in a spreadsheet. Put the numbers from $0$ to $45$ in column A, then in column B write =sqrt(2017-A^2) and scan down for an integer. Copy down is your friend. – Ross Millikan Jul 12 '17 at 20:07
• While obviously not a proof, you can always quickly check wolframalpha, giving it the query 'solve x^2+y^2 over the integers' – Bram28 Jul 12 '17 at 20:13

## 1 Answer

$2017$ is a prime number of the form $4k+1$, and for such a numbers it is well known that the decomposition as a sum of two squares is essentially unique.

The point is that the equality $2017=9^2+44^2$ can be translated in the ring of Gaussian integers $\mathbb{Z}[i]$ as $$2017 = (9+44i)(9-44i).$$

Since $\mathbb{Z}[i]$ is a unique factorization domain, any other factorization of $2017$ coincides with the one above up to units. But the units of Gaussian integers are $\{\pm1, \, \pm i\}$, so the representation $2017= a^2+b^2$ is unique up to order and up to sign of $a$ and $b$.

• Wow, is that a theorem? If yes, does it have a proof? – furfur Jul 12 '17 at 19:59
• It is Fermat theorem (first proven by Euler) en.wikipedia.org/wiki/Fermat%27s_theorem_on_sums_of_two_squares – Francesco Polizzi Jul 12 '17 at 20:00
• Ohhh... the Fermat theorem! Thanks so much, I nearly forgot about it. – furfur Jul 12 '17 at 20:01
• @furfur Maybe not the Fermat theorem. Perhaps just a Fermat theorem. – Ethan Bolker Jul 12 '17 at 20:07
• And the reason $9+44i$ and $9-44i$ are irreducible in $\mathbb{Z}[i]$ is essentially because their square modulus is prime. – Daniel Schepler Jul 12 '17 at 21:37