Euler's factorization method is a technique for factoring a number by writing it as a sum of two squares in two different ways. For example the number can be written as or as and Euler's method gives the factorization .
The idea that two distinct representations of an odd positive integer may lead to a factorization was apparently first proposed by Marin Mersenne. However, it was not put to use extensively until one hundred years later by Euler. His most celebrated use of the method that now bears his name was to factor the number , which apparently was previously thought to be prime even though it is not a pseudoprime by any major primality test.
Euler's factorization method is more effective than Fermat's for integers whose factors are not close together and potentially much more efficient than trial division if one can find representations of numbers as sums of two squares reasonably easily. The methods used to find representations of numbers as sums of two squares are essentially the same as with finding differences of squares in Fermat's factorization method.
Disadvantage and limitation
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.
Theoretical basis
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 we find as a product of sums of two squares.
First deduce that
and factor both sides to get
- (1)
Now let and so that there exists some constants satisfying
- ,
- ,
- ,
- ,
Substituting these into equation (1) gives
Canceling common factors yields
Now using the fact that and son pares de números primos relativos, encontramos que
Entonces
Ahora vemos quey
Aplicando la identidad de Brahmagupta-Fibonacci obtenemos
Como cada factor es una suma de dos cuadrados, uno de ellos debe contener ambos números pares:oSin pérdida de generalidad, supongamos que el pares par. La factorización entonces se convierte en
Ejemplo resuelto
Desde:
Tenemos de la fórmula anterior:
De este modo,
Pseudocódigo
función Euler_factorize(int n) -> lista[int] si es_primo(n) entonces print("El número no es factorizable") función de salida bucle for desde a=1 hasta a=techo(sqrt(n)) b2 = n - a*a b = piso(raíz cuadrada(b2)) si b*b==b2 romper bucle preservando a,b si a*a+b*b!=n entonces print("No se encontró ninguna expresión para n como suma de cuadrados") función de salida bucle for desde c=a+1 hasta c=techo(sqrt(n)) d2 = n - c*c d = piso(raíz cuadrada(d2)) si d*d==d2 entonces romper bucle preservando c,d si c*c+d*d!=n entonces print("No se pudo encontrar una segunda expresión para n como suma de cuadrados") función de salida A = ca, B = c+a C = bd, D = b+d k = MCD(A,C)//2, h = MCD(B,D)//2 l = MCD(A,D)//2, m = MCD(B,C)//2 factor1 = k*k + h*h factor2 = l*l + m*m devolver lista[ factor1, factor2 ]Referencias
- Ore, Oystein (1988). «El método de factorización de Euler» . Teoría de números y su historia . Courier Corporation. págs. 59-64 . ISBN 978-0-486-65620-5.
- McKee, James (1996). "Convirtiendo el método de factorización de Euler en un algoritmo de factorización". Boletín de la Sociedad Matemática de Londres . 4 (28): 351– 355. doi : 10.1112/blms/28.4.351 .
- Algoritmos de factorización de enteros