Currently there may be errors shown on top of a page, because of a missing Wiki update (PHP version and extension DPL3). |
Topics | Help • Register • News • History • How to • Sequences statistics • Template prototypes |
Self-initializing quadratic sieve
The self-initializing quadratic sieve (SIQS) is a factorization method based on the multiple polynomial quadratic sieve (MPQS).
Contents
[hide]Introduction
Let N be the number to be factored. This number must not be a perfect power. If somehow we find two integers X and Y such that
In order to find these values X and Y the method finds relations which have the form
The relations found are combined using multiplications. The left hand side will always be a square because is a product of squares, so the goal is to have a square at the right hand side. A number is a square when all its prime factors appear an even number of times.
For example: let the number to factor be N = 1817 and we have found the following relations with factor base = {2, 7, 13}:
Both relations have non-square RHS, since the exponent of 13 is not even. But multiplying them we get:
Since
Which relations have to multiplied to find a square in the RHS is a linear algebra problem.
Sieving
We will sieve in the interval [-M, +M] using several polynomials
The advantage of this method versus MPQS is that once the first polynomial to sieve is generated, a lot of polynomials using the same value of the coefficient
Generating the factor base
In order to determine the factor base, we have to notice that it includes all the possible factors of
- Factoring a 60 digit number: F = 60000
- Factoring a 70 digit number: F = 350000
- Factoring a 80 digit number: F = 900000
The next step consists in computing the modular square roots of
Generating the first polynomial
Now we compute a value of
- Their product is about
. - Each factor is on the range 2000 to 4000.
- When selecting the primes of the factor base for the second and further values of the coefficient
, there must be at least two different primes from previous selections.
The last two considerations reduce the probability of finding duplicate relations, i.e., relations that can be deduced from the others, that would be discarded by the linear algebra operations, thus increasing the computation time.
If the factors are very large, we will run out of polynomials too quickly and we have to select another value of the coefficient
Now for each value of the index
- Compute
where is computed by multiplying excluding from the factors. - If
then replace with . - Let
using multiple precision. This means that this array holds multiple precision integers.
Let
For each prime
- Compute
as the inverse of modulo . This can be computed using single precision, provided that fits in a computer word. - For each value of the index
such that compute . - Compute the first solution as
and add to all locations of the sieve array. - Compute the second solution as
and add to all locations of the sieve array.
Obtaining relations
Walk through the sieve array. For each element greater than about
Changing polynomial
Suppose we generated polynomial number i and we want to generate polynomial number i+1 where
Let v be the number of bits set to zero at the right of the number 2i when written in binary.
If the bit immediately at the left of the rightmost "1" when the number i written in binary is zero, let e = 1, otherwise let e = -1.
Let
Initialize the sieve array to zeros.
For each prime
- Compute
and add to all locations of the sieve array. - Compute
and add to all locations of the sieve array.
Then go to the Obtaining relations subsection.
Large prime variation
A variation that makes the sieving about twice as fast but requiring more memory, named PSIQS, consists in selecting a large prime bound (about 64 F). If after the trial division by the primes in the factor base the quotient is less than the large prime bound, we collect this partial relation in a different location than full relations (when the final quotient is 1). If the large prime found is the same than the large prime found in a previous partial relation, we can combine them:nnLet
.
This full relation can be stored with the other full relations found. At the beginning of PSIQS the number of full relations found in this way will be small, but it increases as the algorithm progresses, and then there will be more relations found from partial relations than without large primes.
Complexity
The theoretical time and space complexity of the quadratic sieve is O(exp(sqrt(log n log log n))) where n is an integer. The constant e is usually used as the base of the logarithm.
External links
- Factoring Integers with the Self-Initializing Quadratic Sieve by Scott Contini (PDF).
- Factorization using the Elliptic Curve Method by Dario Alpern. This Web application performs PSIQS and includes source code.
- A Tale of Two Sieves by Carl Pomerance. Excellent introduction to the Quadratic Sieve and the Number Field Sieve.
- Msieve - SIQS with single and double large prime variation source code (in C language) and Windows executable by Jason Papadopoulos. This is the fastest SIQS version available.
- Quadratic_sieve
- MathWorld article on the quadratic sieve