I want to get all integer solutions of $ x^2+y^2=161701$ using the below theorem I have got the following pair $(401,30) , (399,50)$ because $161701$ is of the form $ 4k+1$ , But I want any analytic method to solve that kind of equation ?
Theorem:A positive integer $n$ is properly representable as a sum of two relatively prime squares if and only if the prime factors of $n$ are all of the form $4k+1$, except for the prime $2$ which may occur to at most the first power.
First of all, we factorize $161701$ in integers, it is: $$ 161701 = 101 \cdot 1601 \ . $$ Now we use the following result about the ring of the Gaussian integers, $$ R=\Bbb Z[i]\ . $$ A prime $p>0$ in the integers, seen now as an element in the unique factorization ring of gaussian integers, has the following chances:
The quadratic reciprocity laws tell us when we can split and when not. (Last two cases.) In our case, the primes are congruent to one modulo $4$, so we can split uniquely: $$ \begin{aligned} 101 &= 10^2+1^2 =(10+i)(10-i)\ ,\\ 1601 &= 40^2+1^2 =(40+i)(40-i)\ . \end{aligned} $$ So we have the prime factor decomposition in $R$: $$ 161701 = (10+i)(10-i)(40+i)(40-i)\ . $$ Each solution of $(x+iy)(x-iy)=161701$ corresponds (up to units) to grouping above the factors in two parts, in each part we have exactly one of $10\pm i$ and exactly one of $40\pm i$. This leads to the solutions obtained by expanding
All integer solutions are obtained by also taking the conjugates, and also using the four units $1,i,-1,-i$. So we expect $16=4\cdot 4$ solutions with $x,y\in\Bbb Z$. (The computer confirms below.)
Some computer experiments:
And all integer solutions: