TITLE: Factoring a number of complex integers?
QUESTION [11 upvotes]: Say you are given a number (ex: $377$) and you express it in a form that allows you to factor it over the complex integers:
Notice,
$377 = 16^2 + 11^2$
Thus:
$(16 + 11i) $ and $(16 - 11i)$
Are factors of our number. The way that people can use known rational points on a curve to find others... Is there a way to use known complex integral points on the curve $xy = 377$ to find other integral points?
PS the solution is $(29 \times 13) $

REPLY [9 votes]: There is something else you can do, but you have to notice a little more.  You observed that $$377 = 16^2 + 11^2.$$
But what you didn't mention was that $$377 = 19^2 + 4^2.$$
When you have the same number as a sum of two squares in two ways like this, you can factor it as follows:
Calculate ${19 + 11\over 2} = 15$ and ${19 -11\over 2}= 4$ and call those $ac$ and $bd$.  And then calculate ${16+4\over 2} = 10$  and ${16-4\over 2} = 6$ and call those $ad$ and $bc$.  Then you have:
$$\begin{align}
ac & = 15\\
bd & = 4 \\
ad & = 10 \\
bc & = 6
\end{align}$$
Then you can solve these to get $$\begin{align}
a & = 5 \\
b & = 2 \\
c & = 3 \\
d & = 2 
\end{align}$$
and here is where the magic happens: $$\begin{align}
377 & = (a^2 + b^2)(c^2 + d^2) \\
& = 29\cdot 13
\end{align}$$
This is a consequence of the two-square identity, which Wikipedia calls the "Brahmagupta–Fibonacci identity", even though it was known to Diophantus much earlier.