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.

3.4 Pseudoprimes 131<br />

}<br />

g =gcd(s, x);<br />

return “the largest divisor of x composed of primes from P is g”;<br />

The Bernstein Algorithm 3.3.1 is an important addition to the repertoire<br />

of computational number theory. It can profitably be used to speed up various<br />

other algorithms where smoothness is desired. One example arises in the<br />

step [Factor orders] of the Atkin–Morain primality test (Algorithm 7.6.3).<br />

Algorithm 3.3.1 can even be useful in situations in which sieving is completely<br />

appropriate, such as in the quadratic sieve and number field sieve factoring<br />

algorithms (see Chapter 6). Indeed, in these algorithms, the yield rate of<br />

smooth numbers can be so small, it is advantageous to sieve only partially<br />

(forget about small primes in the factor base, which involve the most memory<br />

retrievals), tune the sieve to report candidates with a large smooth divisor,<br />

and then run Algorithm 3.3.1 on the much smaller, but still large, reported<br />

set. This idea of removing small primes from a sieve can be found already in<br />

[Pomerance 1985], but with Algorithm 3.3.1 it can be used more aggressively.<br />

3.4 Pseudoprimes<br />

Suppose we have a theorem, “If n is prime, then S is true about n,” where “S ”<br />

is some easily checkable arithmetic statement. If we are presented with a large<br />

number n, and we wish to decide whether n is prime or composite, we may<br />

very well try out the arithmetic statement S and see whether it actually holds<br />

for n. If the statement fails, we have proved the theorem that n is composite.<br />

If the statement holds, however, it may be that n is prime, and it also may<br />

be that n is composite. So we have the notion of S-pseudoprime, which is a<br />

composite integer for which S holds.<br />

One example might be the theorem, If n is prime, then n is 2 or n is<br />

odd. Certainly this arithmetic property is easily checked for any given input<br />

n. However, as one can readily see, this test is not very strong evidence of<br />

primality, since there are many more pseudoprimes around for this test than<br />

there are genuine primes. Thus, for the concept of “pseudoprime” to be useful,<br />

it will have to be the case that there are, in some appropriate sense, few of<br />

them.<br />

3.4.1 Fermat pseudoprimes<br />

The fact that the residue a b (mod n) may be rapidly computed (see Algorithm<br />

2.1.5) is fundamental to many algorithms in number theory. Not least of these<br />

is the exploitation of Fermat’s little theorem as a means to distinguish between<br />

primes and composites.<br />

Theorem 3.4.1 (Fermat’s little theorem). If n is prime, then for any<br />

integer a, we have<br />

a n ≡ a (mod n). (3.2)

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

Saved successfully!

Ooh no, something went wrong!