How to find the sum of squares representations of a number? [duplicate]

This question already has an answer here:

I have a number, say 1885, I can prove that n can be represented as a sum of squares:

Thm: n is the sum of 2 squares IF AND ONLY IF each prime factor of n that is congruent to 3(mod4) occurs to an even power in the Prime Power Decomposition of n. 1885=5x13x29, all of which are congruent to 1(mod4)

In the question I am given that 1885 can be represented as a sum of squares in 4 distinct ways. How do I go about solving for them?

marked as duplicate by Guy Fsone, Namaste, Krish, Misha Lavrov, Robert ZNov 26 '17 at 8:13

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.

• Factorise it, and then express each prime factor as a sum of two squares. – Lord Shark the Unknown Nov 25 '17 at 18:15
• Can you provide details for how you proved your theorem? – James Arathoon Nov 25 '17 at 18:33

2 Answers

The Fibonacci identity is

$$(a^2+b^2)(c^2+d^2) = (ac+bd)^2 + (ad-bc)^2 = (ac-bd)^2 + (ad+bc)^2.$$

So after you find $5=2^2+1^2$ and $13 = 3^2+2^2$ you have

$$65 = (2^2+1^2)(3^2+2^2) = 8^2 + 1^2 = 4^2 + 7^2.$$

Then repeat when you find $29 = 5^2+2^2.$

$1885=5\times 13\times 29$

$5=2^2+1^2$

$13=2^2+3^2$

$29=2^2+5^2$

$\ldots$

$1885=6^2+ 43^2=11^2+ 42^2=21^2+38^2=27^2+34^2$

Hope this can be useful