I’m trying to find all the ordered sums of squares: $n=x^2+y^2$, $0\leq x\leq y$ for particular $n$.
I’m confused about the sum of squares formula presented on Wolfram Alpha
“ To find in how many ways a positive integer n>1 can be expressed as a sum of $k=2$ squares ignoring order and signs, factor it as”
$n=2^{a_0}p_1^{2a_1}\cdots p_r^{2a_r}q_1^{b_1}\cdots q_{s}^{b_s}$, $p_i \equiv 3\pmod4$, $q_j\equiv 1 \pmod4$
...
then it is deduced that $r_2(n)=4(b_1+1)(b_2+1)\cdots(b_s+1)$ if $n$ can be factored in such a way, $r_2(n)=0$ if not.
I get that the powers of the $p_i$’s need to be even, because if $p$ is prime and $p \not\equiv 1 \pmod 4$ then $p$ cannot be written as a sum of squares, so multiplying by a square does not affect our sum, as sums are closed under multiplication.
This formula reminds me of a combinatorics problem but I can’t figure out where the $4$ comes from, or why we $\color{red}{\text{add 1}}$ to the powers $b_j$’s in the product. Why doesn’t $2^{a_0}$ affect $r_2(n)$? Or does it?
Edit:
I’m really having trouble understanding what the formula for $r_2(n)$ really means, say I had $n=50$ then the formula gives $r_2(50)=4\cdot 3=12$ while $50=1^2+7^2=5^2+5^2$ are the only two representations.
How does one go from $12$ to $2$?
Furthermore, given this question they were able to divide $48$ by $8$ to get $6$ representations, but I thought the formula was irrespective of signs and order?