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.

192 Chapter 4 PRIMALITY PROVING<br />

j =0, 1,...,I−1. Each of these functions fixes an expression that is symmetric<br />

in g, gn ,...,gnI−1, so such an expression must be in the fixed field Zn. This<br />

is the assertion of (3).<br />

It is not true that every choice for g with g ≡ 0(modf) satisfies (2). But<br />

the group K∗ is cyclic, and any cyclic generator satisfies (2). Moreover, there<br />

are quite a few cyclic generators, so a random search for g should not take long<br />

to find one. In particular, if g is chosen randomly as a nonzero polynomial in<br />

Zn[x] of degree less than I, then the probability that g satisfies (2) is at least<br />

ϕ(nI − 1)/(nI − 1) (given that n is prime and f is irreducible of degree I), so<br />

the expected number of choices before a valid g is found is O(ln ln(nI )).<br />

Butwhatoff? Are there irreducible polynomials in Zn[x] ofdegreeI, can<br />

we quickly recognize one when we have it, and can we find one quickly? Yes,<br />

yes, yes. In fact (2.5) shows that not only are there irreducible polynomials<br />

of degree I, but that there are plenty of them, so that a random degree I<br />

polynomial has about a 1 in I chance of being irreducible. See Exercise 2.12<br />

in this regard. Further, Algorithm 2.2.9 or 2.2.10 provides an efficient way to<br />

test whether a polynomial is irreducible.<br />

We now embody the above thoughts in the following explicit algorithm:<br />

Algorithm 4.3.4 (Finite field primality test). We are given positive integers<br />

n, I, F with F |n I − 1, F ≥ n 1/2 and we are given the complete prime<br />

factorization of F . This probabilistic algorithm decides whether n is prime or<br />

composite, returning “n is prime” in the former case and “n is composite” in the<br />

latter case.<br />

1. [Find irreducible polynomial of degree I]<br />

Via Algorithm 2.2.9 or 2.2.10, and using Algorithm 4.3.2 for the gcd steps,<br />

attempt to find a random monic polynomial f in Zn[x] of degree I that<br />

is irreducible if n is prime. That is, continue testing random polynomials<br />

until the irreducibility test used either returns YES, or its gcd step finds a<br />

nontrivial factorization of n. In the latter case, return “n is composite”;<br />

// The polynomial f is irreducible if n is prime.<br />

2. [Find primitive element]<br />

Choose g ∈ Zn[x] at random with g monic, deg g

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

Saved successfully!

Ooh no, something went wrong!