<!-- #################################################################### -->
<!-- ##                                                                ## -->
<!-- ##  preface.xml        FactInt documentation         Stefan Kohl  ## -->
<!-- ##                                                                ## -->
<!-- #################################################################### -->

<Chapter Label="ch:Preface"><Heading>Preface</Heading>

<!-- #################################################################### -->

Factoring large integers is a computationally very difficult problem,
and there is no general factorization algorithm known which can be used
for factoring products of two primes with more than about 100 decimal
digits each on currently existing computers. But there are methods
(not algorithms in the sense that it is guaranteed that they will give
the desired result after a finite number of steps) for factoring integers
with prime factors being far beyond the range where trial division is
feasible. <P/>

One important class of such methods is based on exponentiation in
suitably chosen groups acting on subsets of the <M>k</M>-fold Cartesian
product of the set of residue classes (mod <M>n</M>), where <M>n</M> denotes
the number to be factored.
Representatives of this class are the Elliptic Curves Method (ECM),
Pollard's&nbsp;<M>p-1</M> and Williams'&nbsp;<M>p+1</M>.
These methods have the important property that they find smaller
factors usually considerably faster than larger ones.
This however comes along with the drawback of suboptimal performance
for large factors. <P/>

The other important class consists of the so-called factor base methods.
Their run time depends only on the size of the number <M>n</M> to be
factored, and not on the size of its factors.
Factor base methods compute factorizations of perfect squares
(mod&nbsp;<M>n</M>) over an appropriately chosen factor base.
A factor base is a set of small prime numbers, or of
<Index Key="prime ideal">prime ideal</Index>
prime ideals in the case of the
<Index Key="Generalized Number Field Sieve">
  Generalized Number Field Sieve
</Index>
Generalized Number Field Sieve.
The factor base methods use these factorizations to determine a pair of
integers <M>(x,y)</M> such that <M>x^2</M> and <M>y^2</M> are congruent
(mod&nbsp;<M>n</M>), but <M>\pm x</M> and <M>\pm y</M> are not.
In this situation, taking <M>\gcd(n,x-y)</M> will yield
a nontrivial divisor of&nbsp;<M>n</M>.
Representatives of this class are the Continued Fraction Algorithm
(CFRAC), the Multiple Polynomial Quadratic Sieve (MPQS) and the
already mentioned Generalized Number Field Sieve (GNFS). The latter has
the asymptotically lowest average-case complexity of all factoring
methods known today. It has however the drawback of being more efficient
than the MPQS only for numbers with more than about 100 decimal digits,
which is probably not within the feasible range of such a function
implemented in&nbsp;&GAP;.
The first two methods are implemented in this package. <P/>

Except for the <Q>naive</Q> methods like trial division and some
<Q>historical</Q> methods, the only method which I am aware of
that does not fit into one of the two classes mentioned above is
<Index Key="Pollard's Rho">Pollard's Rho</Index>
Pollard's Rho, which is already implemented in the &GAP; Library. <P/>

With respect to the current state-of-the-art in integer factorization,
see the
<Index Key="RSA Factoring Challenge">RSA Factoring Challenge</Index>
<URL Text="Factoring Challenge">
https://en.wikipedia.org/wiki/RSA_Factoring_Challenge</URL>
which was run by the RSA Laboratories until 2007.

<!-- #################################################################### -->

</Chapter>

<!-- #################################################################### -->
