# In how many ways can a number be expressed as a sum of squares of two natural numbers? [duplicate]

This question already has an answer here:

In how many ways can $145^2$ be expressed as sum of two squares?

I tried solving it by finding out the Pythagoren triplets. $145= m^2+n^2 = 12^2+1^2$ & $9^2+8^2$ so triplet is $(145, m^2-n^2 , 2mn) = (145,143,24)=29*(5,4,3)$ & $(145,17,144)$ & one will come from $29$.. i.e $5*(29,21,20)$ total triplets 4. $(145,143,24)$ , $(145,17,144)$ , $(145,116,87)$ & $(145 , 105,100)$. Is there any easier way of doing this?

## marked as duplicate by Jyrki Lahtonen, Claude Leibovici, Hagen von Eitzen, Peter Taylor, Gabriel RomonAug 20 '14 at 12:12

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.

• What have you tried? If you tell us this then we will be better able to help you. And it helps us feel that we are not just doing your homework for you. – user1729 Aug 18 '14 at 13:27
• I tried solving it by finding out the pythagoras triplets.145= m²+n² = 12²+1² & 9²+8² so triplet is (145, m²-n² , 2mn) = (145,143,24) & (145,17,144) 29*(5,4,3) & one will come from 29.. i.e 5*(29,21,20) total triplets 4. (145,143,24) , (145,17,144) , (145,116,87) & (145 , 105,100).Is there any easier way of doing this? – Vinisha Mallick Aug 19 '14 at 5:48
• The formula for this equation you can see there. math.stackexchange.com/questions/153603/… – individ Aug 19 '14 at 11:39