Rational sieve
   HOME

TheInfoList



OR:

In
mathematics Mathematics is an area of knowledge that includes the topics of numbers, formulas and related structures, shapes and the spaces in which they are contained, and quantities and their changes. These topics are represented in modern mathematics ...
, the rational sieve is a general
algorithm In mathematics and computer science, an algorithm () is a finite sequence of rigorous instructions, typically used to solve a class of specific Computational problem, problems or to perform a computation. Algorithms are used as specificat ...
for factoring integers into prime factors. It is a special case of the
general number field sieve In number theory, the general number field sieve (GNFS) is the most efficient classical algorithm known for factoring integers larger than . Heuristically, its complexity for factoring an integer (consisting of bits) is of the form :\exp\left( ...
. While it is less efficient than the general algorithm, it is conceptually simpler. It serves as a helpful first step in understanding how the general number field sieve works.


Method

Suppose we are trying to factor the
composite number A composite number is a positive integer that can be formed by multiplying two smaller positive integers. Equivalently, it is a positive integer that has at least one divisor other than 1 and itself. Every positive integer is composite, prime, ...
''n''. We choose a bound ''B'', and identify the ''
factor base 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. Usage in factoring algorithms A factor base is a ...
'' (which we will call ''P''), the set of all primes less than or equal to ''B''. Next, we search for positive integers ''z'' such that both ''z'' and ''z+n'' are ''B''-
smooth Smooth may refer to: Mathematics * Smooth function, a function that is infinitely differentiable; used in calculus and topology * Smooth manifold, a differentiable manifold for which all the transition maps are smooth functions * Smooth algebrai ...
— i.e. all of their prime factors are in ''P''. We can therefore write, for suitable exponents a_i, z=\prod_ p_i^ and likewise, for suitable b_i, we have z+n=\prod_ p_i^. But z and z+n are congruent modulo n, and so each such integer ''z'' that we find yields a multiplicative relation (mod ''n'') among the elements of ''P'', i.e. :\prod_ p_i^ \equiv \prod_ p_i^ \pmod n (where the ''ai'' and ''bi'' are nonnegative integers.) When we have generated enough of these relations (it's generally sufficient that the number of relations be a few more than the size of ''P''), we can use the methods of
linear algebra Linear algebra is the branch of mathematics concerning linear equations such as: :a_1x_1+\cdots +a_nx_n=b, linear maps such as: :(x_1, \ldots, x_n) \mapsto a_1x_1+\cdots +a_nx_n, and their representations in vector spaces and through matrices. ...
to multiply together these various relations in such a way that the exponents of the primes are all even. This will give us a
congruence of squares In number theory, a congruence of squares is a congruence commonly used in integer factorization algorithms. Derivation Given a positive integer ''n'', Fermat's factorization method relies on finding numbers ''x'' and ''y'' satisfying the equali ...
of the form a2≡b2 (mod ''n''), which can be turned into a factorization of ''n'' = gcd(''a''-''b'',''n'')×gcd(''a''+''b'',''n''). This factorization might turn out to be trivial (i.e. ''n''=''n''×1), in which case we have to try again with a different combination of relations; but with luck we will get a nontrivial pair of factors of ''n'', and the algorithm will terminate.


Example

We will factor the integer ''n'' = 187 using the rational sieve. We'll arbitrarily try the value ''B''=7, giving the factor base ''P'' = . The first step is to test ''n'' for divisibility by each of the members of ''P''; clearly if ''n'' is divisible by one of these primes, then we are finished already. However, 187 is not divisible by 2, 3, 5, or 7. Next, we search for suitable values of ''z''; the first few are 2, 5, 9, and 56. The four suitable values of ''z'' give four multiplicative relations (mod 187): There are now several essentially different ways to combine these and end up with even exponents. For example, *()×(): After multiplying these and canceling out the common factor of 7 (which we can do since 7, being a member of ''P'', has already been determined to be coprime with ''n''), this reduces to 24 ≡ 38 (mod ''n''), or 42 ≡ 812 (mod ''n''). The resulting factorization is 187 = gcd(81-4,187) × gcd(81+4,187) = 11×17. Alternatively, equation () is in the proper form already: *(): This says 32 ≡ 142 (mod ''n''), which gives the factorization 187 = gcd(14-3,187) × gcd(14+3,187) = 11×17.


Limitations of the algorithm

The rational sieve, like the general number field sieve, cannot factor numbers of the form ''pm'', where ''p'' is a prime and ''m'' is an integer. This is not a huge problem, though—such numbers are statistically rare, and moreover there is a simple and fast process to check whether a given number is of this form. Probably the most elegant method is to check whether \lfloor n^\rfloor^b=n holds for any 1 < b < log(n) using an integer version of
Newton's method In numerical analysis, Newton's method, also known as the Newton–Raphson method, named after Isaac Newton and Joseph Raphson, is a root-finding algorithm which produces successively better approximations to the roots (or zeroes) of a real-valu ...
for the root extraction.R. Crandall and J. Papadopoulos, ''On the implementation of AKS-class primality tests,'' available a

/ref> The biggest problem is finding a sufficient number of ''z'' such that both ''z'' and ''z''+''n'' are ''B''-smooth. For any given ''B'', the proportion of numbers that are ''B''-smooth decreases rapidly with the size of the number. So if ''n'' is large (say, a hundred digits), it will be difficult or impossible to find enough ''z'' for the algorithm to work. The advantage of the general number field sieve is that one need only search for smooth numbers of order ''n''1/''d'' for some positive integer ''d'' (typically 3 or 5), rather than of order ''n'' as required here.


References

*A. K. Lenstra, H. W. Lenstra, Jr., M. S. Manasse, and J. M. Pollard, ''The Factorization of the Ninth Fermat Number,'' Math. Comp. 61 (1993), 319-349. Available a

*A. K. Lenstra, H. W. Lenstra, Jr. (eds.) ''The Development of the Number Field Sieve,'' Lecture Notes in Mathematics 1554, Springer-Verlag, New York, 1993.


Footnotes

{{DEFAULTSORT:Rational Sieve Integer factorization algorithms