In the last few days, I have been wondering about the following equation in $x,y \in N$: $$x^2+y^2 = M$$ with $M \in N$. More precisley, I don't understand how can we compute the number of solutions that this equation have and especially how can we find it.
I've tried to use the formula: $(a^2+b^2)(c^2+d^2)=(ac-bd)^2+(ad+bc)^2$, but it looks me like as another complication, especially because I've to do this calculations for large value of $M$. I've also read the post Integer solutions to $x^2+y^2=N$?, but it hasn't really helped me alot.
Any ideas or suggestions? Are there also sites which I can consult on this topic? Thanks.
ANOTHER QUESTION (not already answered)
If using the above formula, we can find the solutions to $x^2+y^2=M$, what if M is a very large prime (such as $M=10000000103$): do I have to do only bruteforcing?
EDIT: As suggested, I have read the page on Wolphram Alpha linked above in the comments, but I still not uderstand in what way we can find the solutions of $x^2+y^2=M$. For example take the case: $x^2+y^2=85$ has $r_2(85)=16$, buit how can we obtain the value of $(x,y)$?