In computational number theory, a factor base is a small set of prime numbers commonly used as a mathematical tool in algorithms involving extensive sieving for potential factors of a given integer.
A factor base is a relatively small set of distinct prime numbers P, sometimes together with -1. Say we want to factorize an integer n. We generate, in some way, a large number of integer pairs (x, y) for which
x ≠ \pmy
x2\equivy2\pmod{n}
x2\pmod{n}andy2\pmod{n}
In practice, several integers x are found such that
x2\pmod{n}
x2\pmod{n}
x2\equivy2\pmod{n}
This congruence may generate the trivial
stylen=1 ⋅ n
Factor bases are used in, for example, Dixon's factorization, the quadratic sieve, and the number field sieve. The difference between these algorithms is essentially the methods used to generate (x, y) candidates. Factor bases are also used in the Index calculus algorithm for computing discrete logarithms.