<s>[INST] Integer solutions of $x^2+5y^2=231^2$ I want to find the integer solutions of the equation
$$x^2+5y^2=231^2.$$
My attempt (a sketch): we can use the unique factorisation of ideals in $\mathbb{Z}[\sqrt{-5}]$. Indeed, we have $231=3\cdot 7\cdot 11$.  One can easily show that $3$ and $7$ split in the product of two prime conjugate ideals each, say $\mathfrak{p}$ and $\mathfrak{q}$, where $(3)=\mathfrak{p}\overline{\mathfrak{p}}$ and $(7)=\mathfrak{q}\overline{\mathfrak{q}}$; whereas $11$ remains inert, i.e. $(11)=\mathfrak{r}$ for some self-congugate prime ideal $\mathfrak{r}$.
Then one has $(x+y\sqrt{-5})(x-y\sqrt{-5})= \mathfrak{p}^2\overline{\mathfrak{p}}^2 \mathfrak{q}^2\overline{\mathfrak{q}}^2 \mathfrak{r}^2$. Since $(x+y\sqrt{-5})$ and $(x-y\sqrt{-5})$ are conjugate, we deduce that 
$(x+y\sqrt{-5})= \mathfrak{p} \overline{\mathfrak{p}}\mathfrak{q} \overline{\mathfrak{q}} \mathfrak{r}=(3)(7)(11)=(231)$. Thus the unique integer solutions are $x=231,y=0$, $x=-231,y=0$. 
Is this correct, or I am missing something?
 [/INST] If $x^2+5y^2=z^2$ and $(x,y,z)=1$ then $x,y,z$ are pairwise coprime and $5y^2=(z+x)(z-x)$. Divide into four cases:
$z\equiv x \pmod 2$, $5|z+x$
$$\left(\frac y2\right)^2=\frac{z+x}{10}\frac{z-x}2$$
If the product of coprime squares is a square then both are squares. Let $z+x=10a^2$, $z-x=2b^2$. Then $z=5a^2+b^2$, $x=5a^2-b^2$ and $y=2ab$.
$z\equiv x \pmod 2$, $5|z-x$
This case is the same as the previous one.
$z\equiv x+1 \pmod 2$, $5|z+x$
$$y^2=\frac{z+x}5(z-x)$$
Applying the same substitution you find $z=\frac{a^2+5b^2}2$, $x=\frac{a^2-5b^2}2$ and $y=ab$.
$z\equiv x+1 \pmod 2$, $5|z-x$
This case is the same as the previous one.
Which means if $z^2$ is of the form $x^2+5y^2$ for coprime integers $x,y$, then $z$ or $2z$ are too.
Back to the problem, if $(x,y)=d$ and $x^2+5y^2=231^2=3^27^211^2$ then $\left(\frac xd\right)^2+5\left(\frac yd\right)^2=\left(\frac{231}d\right)^2$ then the solutions to $a^2+5b^2=\frac{231}d$ and $a^2+5b^2=\frac{462}d$ over all 8 possible values of $d$ will generate all possible pairs $x,y$.
</s>