Wikipedia / Shanks's square forms factorization
Wikipedia / Shanks's square forms factorization
Shanks' square forms factorization is a method for integer factorization devised by Daniel Shanks as an improvement on Fermat's factorization method.
is the integer to be factored. An improvement (noticed by Kraitchik, and there is a good chance that the prime divisors are distributed between these two factors, so that calculation of the greatest common divisor.
was developed by Shanks, who named it Square Forms Factorization or SQUFOF. The algorithm can be expressed in terms of continued fractions or in terms of quadratic forms. Although there are now much more efficient factorization methods available, SQUFOF has the advantage that it is small enough to be implemented on a programmable calculator. Shanks programmed it on an HP-65, made in 1974, which has storage for only nine digit numbers and allows only 100 steps/keystrokes of programming. There are versions of the algorithm that use little memory and versions that store a list of values that run more quickly.
In 1858, the Czech mathematician Václav Šimerka.
Algorithm
Note This version of the algorithm works on some examples but often gets stuck in a loop.
This version does not use a list.
Input, the integer to be factored, which must be neither a prime number nor a perfect square.
Output.
The algorithm:
.
Stephen S. McMath wrote a more detailed discussion of the mathematics of Shanks' method, together with a proof of its correctness.
Example
is a perfect square, so the first phase ends.
. Then:.
.
Example implementation
Below is an example of C function for performing SQUFOF factorization on unsigned integer not larger than 64 bits, without overflow of the transient operations.
References
A very detailed analysis of SQUFOF
A summary of the preceding thesis, also very detailed.
External links
Daniel Shanks: , (transcribed by S. McMath 2004)
Daniel Shanks: , (transcribed by S. McMath 2004)
Stephen S. McMath: , 2005
S. McMath, F. Crabbe, D. Joyner: , 2005
Jason Gower, Samuel Wagstaff: (Published)