<s>[INST] Prove that a positive integer is composite Let $ n $ be a positive integer that can be written as a sum of two relatively prime squares in two distinct ways, that is $ n = a^2 + b^2 = c^2 + d^2 $ so that $ gcd(a, b) = gcd(c, d) = 1, $ then $ n $ is composite.
So I have successfully factored $ n $ into $ \displaystyle \frac{ac + bd}{a - d}.\frac{ac - bd}{a + d} $ and have proved that $ \displaystyle (a - d) | (ac + bd) $ and $ \displaystyle (a + d) | (ac - bd). $ So each of the $ \displaystyle \frac{ac + bd}{a - d} $ and $ \displaystyle \frac{ac - bd}{a + d} $ is an integer, but I am currently stuck on proving that $ n $ is composite. My intention is to prove that both factors of $ n $ are greater than $ 1, $ but no success at this point. Any hint or suggestion? I have tried to use the fact that $ gcd(a, b) = gcd(c, d) = 1, $ but still no progress.
Thanks.  
 [/INST] I carefully read Brillhart's first paper and realized I was unsure about the final step. So, naive or not, here is a lemma.
LEMMA Suppose, with positive integers $n,H,E,F,$ such that $$ nH = EF, $$
while
$$ 1 < E < F < n. $$
Define
$$ g = \gcd(n,E). $$
THEN  both $g > 1$ and $g < n.$
PROOF First, $g \leq E < n.$ Next, we know there are integers $x,y$ such that $$ nx - E y = g. $$
$$ nFx - EF y = gF,  $$
$$ nFx - nHy = gF, $$
$$  n(Fx - Hy) = gF > 0, $$
$$  n \leq   n(Fx - Hy), $$
$$  n \leq gF. $$
Recall $$F < n.$$
$$  n \leq gF < gn.  $$
$$ n < gn. $$
$$ 1 < g.$$
$$ \bigcirc  \bigcirc  \bigcirc  \bigcirc  \bigcirc  \bigcirc  \bigcirc  \bigcirc  \bigcirc  \bigcirc  \bigcirc  \bigcirc  $$
Using the letters in the original question, $n,a,b,c,d \geq 1,$ demand $a > d.$ Note that $a^2 - d^2 = c^2 - b^2 > 0.$ Next
$$ a^2 c^2 - b^2 d^2 =  a^2 c^2 - a^2 b^2 + a^2 b^2 - b^2 d^2  $$
$$ a^2 c^2 - b^2 d^2 =  a^2 (c^2 - b^2) +  b^2 (a^2 -  d^2)  $$
$$ a^2 c^2 - b^2 d^2 =  a^2 (a^2 - d^2) +  b^2 (a^2 -  d^2)  $$
$$ a^2 c^2 - b^2 d^2 =  (a^2 +  b^2) (a^2 -  d^2)  $$
$$ a^2 c^2 - b^2 d^2 =  n (a^2 -  d^2),  $$
$$    n (a^2 -  d^2) =  a^2 c^2 - b^2 d^2 = (ac-bd)(ac+bd) > 0.$$
It is not difficult to check the identity
$$  n^2 = (ac-bd)^2 + (ad+bc)^2, $$ that is one of those Brahmagupta things.
If we had $ac = bd$ we would also have $a/b = d/c,$ leading to $n = b^2 (1 + (a^2 / b^2)) = c^2 (1 + (d^2 / c^2)),$ finally $b=c$ and $a=d.$ This is ruled out, so $ac-bd \geq 1.$ 
It is also not difficult to check the identity
$$  n^2 = (ad-bc)^2 + (ac+bd)^2, $$ that is another of those Brahmagupta things, derivable from the first by negating $b.$
If we had $ad = bc$ we would also have $a/b = c/d,$ leading to $n = b^2 (1 + (a^2 / b^2)) = d^2 (1 + (c^2 / d^2)),$ finally $b=d$ and $a=c.$ This is ruled out, so $|ad-bc| \geq 1,$ AND $ac+bd < n.$ 
SO FAR,
$$ 1 \leq ac-bd < ac + bd < n. $$ However, recall
$$    n (a^2 -  d^2) =   (ac-bd)(ac+bd).$$ Since
$$    (ac-bd)(ac+bd) \geq n$$ but
$$ n > ac+bd, $$ we find
$$    (ac-bd)(ac+bd) > ac+bd $$ and
$$ ac-bd > 1. $$
We have reached
$$ 1 < ac-bd < ac + bd < n. $$
Using  $    n (a^2 -  d^2) =   (ac-bd)(ac+bd),$ apply my LEMMA far above with $H = a^2 - d^2,$ $E = ac-bd,$ $F = ac+bd.$ The conclusion is that $g = \gcd(n, ac-bd)$ results in $1 < g < n.$ Therefore we have the nontrivial factorization $$ n = g \cdot \frac{n}{g}. $$
</s>