Fermat's factorization method writes an odd composite number n = p * q as a difference of two squares, n = a^2 - b^2, where a is (p + q) / 2 and b is (p - q) / 2. The method guesses the first square a^2, starting from the square root of n rounded up, and checks whether the remainder b^2 = a^2 - n is also a perfect square. If it is, the factors are a - b and a + b; if not, a is increased by one and the test repeats. The running time grows with the difference between the two factors, so the method can be very fast when the factors are close together, but it becomes extremely slow once they are far apart, and in practice it is rarely used on its own. The cp-algorithms article adds that looking at squares modulo a fixed small number shows that some values of a can be skipped because they cannot produce a square, which is one of several possible optimizations.
Connections
Credited To
Source Pierre de Fermat (Wikipedia)
In Field
Source Integer factorization (cp-algorithms)
Invented
Source Pierre de Fermat (Wikipedia)
Sources
Integer factorization (cp-algorithms)
In Group: Number Theory and Primality, Fermat's factorization method section
Fermat's factorization method tries to exploit this fact by guessing the first square
In Field: Algorithms and Complexity Theory, Fermat's factorization method section
Fermat's factorization method tries to exploit this fact by guessing the first square
View the SourcePierre de Fermat (Wikipedia)
Credited To: Pierre de Fermat, Work
He invented a factorization method
Invented: Pierre de Fermat, Work
He invented a factorization method
View the SourceReader Challenges (0)
No disputes yet. Spotted an error or a better source? Open the first one.
Sign in to dispute this or suggest a correction.