Algorithm to find the irreducible polynomial. What algorithm can be used find an irreducible polynomial of degree n over the field GF(p) for prime p. The reason I ask is I want to make a program for finite field arithmetic, but creating a field GF(p^k) requires finding a irreducible polynomial. (I'm mostly interested in GF(2^k).)
Jefferson Booth
Answered question
2022-11-08
Algorithm to find the irreducible polynomial What algorithm can be used find an irreducible polynomial of degree n over the field GF(p) for prime p. The reason I ask is I want to make a program for finite field arithmetic, but creating a field requires finding a irreducible polynomial. (I'm mostly interested in .)
Answer & Explanation
cismadmec
Beginner2022-11-09Added 22 answers
Step 1 The multiplicative group of is cyclic of order . If is a generator, then it is a root of the polynomial . We can use the Möbius principle to get rid of roots of lower degree and find that the minimal polynomial of over is
Step 2 For example with and we arrive at
(Actually, the signs do not matter over )
Jenny Roberson
Beginner2022-11-10Added 4 answers
Step 1 As others indicated, you can find irreducible polynomials of degree n by factoring modulo p, and throwing away factors that have too small a degree. The algorithms by Cantor-Zassenhaus and Berlekamp are useful to that end. Do note that the characteristic zero factor in Hagen's answer is very far from being irreducible modulo 2. But, observe that factoring is not an option, when is too big. If that is a concern for you then the easiest to comprehend test I can imagine would be to generate random monic polynomials p(x) of degree m. The probability for such a polynomial to be irreducible is roughly 1/m (the exact number is given by a Möbius formula). You can then either A) Proceed with Berlekamp or Cantor-Zassenhaus and try to factor your candidate. If none are found you know the polynomial is irreducible. Or, B) For each positive integer calculate the greatest common divisor
Step 2 If no common divisors are found, then you know p(x) has no factors of degree d, so if no factors are found with d up to m/2, you know that p(x) must be irreducible. Observe that calculating gcd's like this is quite fast. Only in the first step of Euclid's algorithm will you have high degree polynomials. That high degree polynomial is a binomial, so calculating its remainder modulo p(x) is fast with the aid of square-and-multiply. For small k there are tables. I use this table when , because it gives primitive polynomials, i.e. minimal polynomials of a generator of the multiplicative group of . For other small p and small k Lidl & Niederreiter have more extensive tables. The book is a bit pricy (and also recommended for hardcore enthusiasts on finite fields only), so go to a university library near you rather than order one from Amazon. Also, they put more effort into listing all the irreducible polynomials rather than giving sample irreducibles of several degrees. Depending on what you want to do a given table may not be useful to you.