10.12.2012 Views

Prime Numbers

Prime Numbers

Prime Numbers

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

128 Chapter 3 RECOGNIZING PRIMES AND COMPOSITES<br />

3.3 Recognizing smooth numbers<br />

A very important subroutine in many number-theoretic algorithms involves<br />

identifying the smooth numbers in a given list of numbers. We have many<br />

methods for recognizing these smooth numbers, since any factorization<br />

algorithm will do. However, some factorization algorithms, such as trial<br />

division, find the smaller prime factors of the number being factored before<br />

finding the larger prime factors. Such a method could presumably reject a<br />

number for not being y-smooth before completely factoring it. Factorization<br />

methods with this property include trial division, the Pollard rho method, and<br />

the Lenstra elliptic curve method, the latter two methods being discussed later<br />

in the book. Used as smoothness tests, these three factorization methods have<br />

the following rough complexities: Trial division takes y 1+o(1) operations per<br />

number examined, the rho method takes y 1/2+o(1) operations, and the elliptic<br />

curve method takes about exp((2 ln y ln ln y) 1/2 )=y o(1) operations. Here an<br />

“operation” is an arithmetic step with numbers the size of the specific number<br />

being examined. (It should be pointed out that the complexity estimates for<br />

both the rho method and the elliptic curve method are heuristic.)<br />

Sometimes we can use a sieve to recognize smooth numbers, and when we<br />

can, it is very fast. For example, if we have a string of consecutive integers<br />

or more generally a string of consecutive values of a polynomial with integer<br />

coefficients (and with low degree), and if this string has length L ≥ y, with<br />

maximal member M, then the time to examine every single one of the L<br />

numbers for y-smoothness is about L ln ln M ln ln y, or about ln ln M ln ln y<br />

bit operations per number. (The factor ln ln M arises from using approximate<br />

logarithms, as discussed in Section 3.2.5.) In fact, sieving is so fast that the<br />

run time is dominated more by retrieving numbers from memory than by<br />

doing actual computations.<br />

In this section we shall discuss an important new method of D. Bernstein<br />

(see [Bernstein 2004d]), which can recognize the smooth numbers in any set<br />

of at least y numbers, and whose amortized time per number examined is<br />

almost as fast as sieving: It is (ln 2 y ln M) 1+o(1) bit operations per number,<br />

if the numbers are at most M. To achieve this complexity, though, one must<br />

use sophisticated subroutines for large-integer arithmetic, such as the fast<br />

Fourier transform or equivalent convolution techniqes (see our Chapter 8.8<br />

and [Bernstein 2004e]).<br />

We shall illustrate the Bernstein method with the smoothness bound y set<br />

at 20, and with the set of numbers being examined being 1001, 1002,...,1008.<br />

(It is not important that the numbers be consecutive, it is just easier to<br />

keep track of them for the illustration.) A moment’s inspection shows the 20smooth<br />

numbers in the list to be the first and last, namely 1001 and 1008.<br />

The algorithm not only tells us this, it gives the largest 20-smooth divisor for<br />

each number in the list.<br />

The plan of the Bernstein algorithm, as applied to this example, is first<br />

to find the product of all of the primes up to 20, namely 9699690, and then<br />

reduce this product modulo each of the eight numbers on our list. Say x is on

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!