The great disadvantage of Euler's factorization method is that it cannot be applied to factoring an integer with any prime factor of the form 4k + 3 occurring to an odd power in its prime factorization, as such a number can never be the sum of two squares. Even odd composite numbers of the form 4k + 1 are often the product of two primes of the form 4k + 3 (e.g. 3053 = 43 × 71) and again cannot be factored by Euler's method.
This restricted applicability has made Euler's factorization method disfavoured for computer factoring algorithms, since any user attempting to factor a random integer is unlikely to know whether Euler's method can actually be applied to the integer in question. It is only relatively recently that there have been attempts to develop Euler's method into computer algorithms for use on specialised numbers where it is known Euler's method can be applied.
The Brahmagupta–Fibonacci identity states that the product of two sums of two squares is a sum of two squares. Euler's method relies on this theorem but it can be viewed as the converse, given n = a 2 + b 2 = c 2 + d 2 {\displaystyle n=a^{2}+b^{2}=c^{2}+d^{2}} we find n {\displaystyle n} as a product of sums of two squares.
First deduce that
and factor both sides to get
Now let k = gcd ( a − c , d − b ) {\displaystyle k=\operatorname {gcd} (a-c,d-b)} and h = gcd ( a + c , d + b ) {\displaystyle h=\operatorname {gcd} (a+c,d+b)} so that there exists some constants l , m , l ′ , m ′ {\displaystyle l,m,l',m'} satisfying
gcd ( l , m ) = 1 {\displaystyle \operatorname {gcd} (l,m)=1}
gcd ( l ′ , m ′ ) = 1 {\displaystyle \operatorname {gcd} (l',m')=1}
Substituting these into equation (1) gives
Canceling common factors yields
Now using the fact that ( l , m ) {\displaystyle (l,m)} and ( l ′ , m ′ ) {\displaystyle \left(l',m'\right)} are pairs of relatively prime numbers, we find that
So
We now see that m = gcd ( a + c , d − b ) {\displaystyle m=\operatorname {gcd} (a+c,d-b)} and l = gcd ( a − c , d + b ) {\displaystyle l=\operatorname {gcd} (a-c,d+b)}
Applying the Brahmagupta–Fibonacci identity we get
As each factor is a sum of two squares, one of these must contain both even numbers: either ( k , h ) {\displaystyle (k,h)} or ( l , m ) {\displaystyle (l,m)} . Without loss of generality, assume that pair ( k , h ) {\displaystyle (k,h)} is even. The factorization then becomes
Since: 1000009 = 1000 2 + 3 2 = 972 2 + 235 2 {\displaystyle \ 1000009=1000^{2}+3^{2}=972^{2}+235^{2}}
we have from the formula above:
Thus,