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.

138 Chapter 3 RECOGNIZING PRIMES AND COMPOSITES<br />

The reader should consult Chapter 4 for strategies on proving prime those<br />

numbers we strongly suspect to be prime. However, for practical applications,<br />

one may be perfectly happy to use a number that is almost certainly prime, but<br />

has not actually been proved to be prime. It is with this mindset that people<br />

refer to Algorithm 3.5.6 as a “primality test.” It is perhaps more accurate to<br />

refer to a number produced by such a test as an “industrial-grade prime,” to<br />

use a phrase of H. Cohen.<br />

The following algorithm may be used for the generation of random<br />

numbers that are likely to be prime.<br />

Algorithm 3.5.7 (“Industrial-grade prime” generation). We are given an<br />

integer k ≥ 3 andanintegerT ≥ 1. This probabilistic algorithm produces a<br />

random k-bit number (that is, a number in the interval 2 k−1 , 2 k ) that has not<br />

been recognized as composite by T iterations of Algorithm 3.5.6.<br />

1. [Choose candidate]<br />

Choose a random odd integer n in the interval 2 k−1 , 2 k ;<br />

2. [Perform strong probable prime tests]<br />

for(1 ≤ i ≤ T ) { // i is a dummy counter.<br />

Via Algorithm 3.5.6 attempt to find a witness for n;<br />

if(a witness is found for n) goto [Choose candidate];<br />

}<br />

return n; // n is an “industrial-grade prime.”<br />

An interesting question is this: What is the probability that a number<br />

produced by Algorithm 3.5.7 is composite? Let this probability be denoted<br />

by P (k, T). One might think that Theorem 3.5.4 immediately speaks to<br />

this question, and that we have P (k, T) ≤ 4 −T . However, the reasoning is<br />

fallacious. Suppose k = 500,T = 1. We know from the prime number theorem<br />

(Theorem 1.1.4) that the probability that a random odd 500-bit number is<br />

prime is about 1 chance in 173. Since it is evidently more likely that one<br />

will witness an event with probability 1/4 occurring before an event with<br />

probability 1/173, it may seem that there are much better than even odds<br />

that Algorithm 3.5.7 will produce composites. In fact, though, Theorem 3.5.4<br />

is a worst-case estimate, and for most odd composite numbers the fraction of<br />

witnesses is much larger than 3/4. It is shown in [Burthe 1996] that indeed<br />

we do have P (k, T) ≤ 4 −T .<br />

If k is large, one gets good results even with T = 1 in Algorithm 3.5.7. It<br />

isshownin[Damg˚ard et al. 1993] that P (k, 1)

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

Saved successfully!

Ooh no, something went wrong!