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.

236 Chapter 5 EXPONENTIAL FACTORING ALGORITHMS<br />

B are sequentially generated, one can look for a match in A, provided that<br />

one has rapid means for content-searching in an ordered list. After the match<br />

is found, it is not necessary to continue to generate B, so that on average a<br />

savings of 50% can be gained.<br />

The complexity for Step [Construct lists] is O( √ n) group operations, and<br />

for Step [Sort and find intersection] is O( √ n ln n) comparisons. The space<br />

required is what is needed to store O( √ n) group elements. If one has no idea<br />

how large the group G is, one can let n run through the sequence 2 k for<br />

k =1, 2,... . If no match is found with one value of k, repeat the algorithm<br />

with k + 1. Of course, the sets from the previous run should be saved and<br />

enlarged for the next run. Thus if the group G has order m, wecertainlywill<br />

be successful in computing the logarithm of t in operation count O( √ m ln m)<br />

and space O( √ m) group elements.<br />

A more elaborate version of this idea can be found in [Buchmann et al.<br />

1997], [Terr 1999]. Also see [Blackburn and Teske 1999] for other baby-steps,<br />

giant-steps strategies.<br />

We compare Algorithm 5.3.1 with the rho method for discrete logarithms<br />

in Section 5.2.2. There the running time is O( √ m) and the space is<br />

negligible. However, the rho method is heuristic, while baby-steps, giant-steps<br />

is completely rigorous. In practice, there is no reason not to use a heuristic<br />

method for a discrete logarithm calculation just because a theoretician has<br />

not yet been clever enough to supply a proof that the method works and does<br />

so within the stated time bound. So in practice, the rho method majorizes<br />

the baby-steps, giant-steps method.<br />

However, the simple and elegant idea behind baby-steps, giant-steps is<br />

useful in many contexts, as we shall see in Section 7.5. It also can be used<br />

for factoring, as shown in [Shanks 1971]. In fact, that paper introduced the<br />

baby-steps, giant-steps idea. The context here is the class group of binary<br />

quadratic forms with a given discriminant. We shall visit this method at the<br />

endofthischapter,inSection5.6.4.<br />

5.4 Pollard p − 1 method<br />

We know from Fermat’s little theorem that if p isanoddprime,then2 p−1 ≡ 1<br />

(mod p). Further, if p − 1|M, then2 M ≡ 1(modp). So if p is a prime factor<br />

of an integer n, thenp divides gcd(2 M − 1,n). The p − 1methodofJ.Pollard<br />

makes use of this idea as a tool to factor n. His idea is to choose numbers<br />

M with many divisors of the form p − 1, and so search for many primes p as<br />

possible divisors of n in one fell swoop.<br />

Let M(k) be the least common multiple of the integers up to k.So,M(1) =<br />

1, M(2) = 2, M(3) = 6, M(4) = 12, etc. The sequence M(1),M(2),...may be<br />

computed recursively as follows. Suppose M(k) has already been computed. If<br />

k+1 is not a prime or a power of a prime, then M(k+1) = M(k). If k+1 = p a ,<br />

where p is prime, then M(k +1)=pM(k). A precomputation via a sieve, see<br />

Section 3.2, can locate all the primes up to some limit, and this may be easily<br />

augmented with the powers of the primes. Thus, the sequence M(1),M(2),...

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

Saved successfully!

Ooh no, something went wrong!