in my function PolynomialIrreducibility()
I'm evaluating if entered polynomial is irreducible or not over GF(prime_number).
void PolynomialIrreducibility () {
// Enter prime number
ZZ prime_number;
ZZ_pX polynom;
do {
cout << "Enter prime number: ";
cin >> prime_number;
} while (!ProbPrime(prime_number));
ZZ_p::init(prime_number); // define GF(prime_number)
// Enter n
long n;
do {
cout << "Enter n: ";
cin >> n;
} while (n < 1);
BuildIrred(polynom, n); // generate an irreducible polynomial P of degree n over GF(prime_number)
ZZ_pE::init(polynom); // define GF(prime_number^n)
// Enter polynom
ZZ_pX input_polynom;
cout << "Enter polynom: ";
cin >> input_polynom;
ZZ_pEX convert_polynom;
conv(convert_polynom, input_polynom);
if (DetIrredTest(convert_polynom)) {
//if (ProbIrredTest(convert_polynom)) {
//if (IterIrredTest(convert_polynom) {
cout << "-> Irreducible polynomial" << endl;
}
else {
cout << "-> Reducible polynomial" << endl;
}
}
While testing implemented function with irreducible polynomial x^2 + x + 2 all three functions (DetIrredTest, ProbIrredTest, IterIrredTest) for determining if polynomial is irreducible or not evaluate that it is even though it isn't irreducible over GF(3) as shown below.
Enter prime number: 3
Enter n: 2
Enter polynom: [2 1 1]
-> Reducible polynomial
Please, am I evaluating the irreducibility in the wrong way or am I doing something else wrong?
There is an issue as commented by aschepler, a irreducible polynomial of degree n in GF(p) is not irreducible in GF(p^n). It will have n roots. I suggest making this change so that DetIrredTest() operates in GF(p):
I found three irreducible polynomials in GF(3) that can be used as reducing polynomials for GF(9):