Number of integer solutions of $2n^2=a^2+b^2$ For a given integer $n$, how many positive integer $(a,b)$ pairs exist which satisfy $2n^2=a^2+b^2$?
In particular, I'm looking for all $n$s where there are exactly 105 solutions. (One solution is $(n,n)$, and there are $2\cdot 52$ other solutions: $(a,b)$ and $(b,a)$ are two different solutions if $a\ne b$.)
I'm sure that there are theorems about the solutions of this kinds of equations. Where can I find them and read more?
 A: Here is a very closely related question. The formula for the number of solutions is the product of $2m+1$ where $m$ runs through the multiplicities of division of the prime factors of $n$ that are${}\equiv1\pmod4$. So you could take $n=5^{52}$ as one solution to you problem, but you'll get smaller solutions using the factorization $105=3\times5\times7$, the smallest one being $n=5^3\times13^2\times17=359125$. A proof of the result (which uses Gaussian integers) can be found in this answer.
A: You can find a proof in LeVeque's "Fundamentals of Number Theory" of the following fact:
"If $n$ is written as a product 
$$n = 2^u \times \prod_{p_j\equiv 1 \pmod{4}} p_j^{t_j} \times \prod_{q_j\equiv 3 \pmod{4}} q_j^{s_j}$$
and we write this as $2^un'm$ where $n'$ is the first product and $m$ is the second, then the number of representations of $n$ as a sum of two squares is zero if $m$ is not a square , and $4\tau(n')$ if $m$ is a square. (Where $\tau(n)$ is the the number of positive divisors of $n$.
In my edition (1977), this appears as Theorem 7,6 on page 185.
Note that in the above, the number of representations includes those by squares of negative integers, so that we need to remove the factor 4, if we are considering only representations by positive integers.
Thus we need to find the smallest $k$ such that $\tau(k) = 105$. Using the standard formula for $\tau(k)$, we need $k = p_1^6\times p_2^4 \times p_3^2$ where the primes $p_i \equiv 1 \pmod{4}$.
This should give $k=5^6\times13^4\times 17^2$, which means that your $n$ needs to be $5^3\times 13^2 \times 17 = 359125$
A: Observe that, $a,b$ must be of same parity , else $a^2+b^2$ will be odd.
$=>n^2=(\frac{a+b}{2})^2+(\frac{a-b}{2})^2=p^2+q^2$ for some integer $p,q$
( So, $a+b=±2p$ and  $a-b=±2q$ leading to two pairs of $(a,b)$. )
For $n^2$ the factor(which will be in the  even power, say $P^2$) of the form $(2^r\prod q_i)^2$ where $q_i≡-1(mod\ 4)$ will have only one form as the sum of squares $0^2+P^2$.
Any number $N$  having $m$ prime factors each ≡1(mod 4) can be expressed $2^{m-1}$ ways.
If ${2u}$ is the highest power of $p_i$ that divides $n^2$  where $p_i$ ≡1(mod 4),
the number possible ways of  $p_i^{2u}$ can be expressed as a sum of squares is
$u$ if we only allow positive integers, 
$2u$ if we allow non-zero integers, 
$2u+1$ (1 due to $p_i^{2u}+0^2$) if  we allow all integers .
If $n^2=(2^r\prod q_i)^2\prod_{1 ≤i ≤ n} p_i^{2u_i}$, the number possible ways will be $\prod (2u_i+1)$
Look into this, Theorem 3 for details. 
