- galois.is_primitive_element(element: PolyLike, irreducible_poly: Poly) bool
Determines if
is a primitive element of the Galois field with degree- irreducible polynomial over .Examples¶
In the extension field
, the element is a primitive element whose order is .In [1]: GF = galois.GF(3**4) In [2]: f = GF.irreducible_poly; f Out[2]: Poly(x^4 + 2x^3 + 2, GF(3)) In [3]: galois.is_primitive_element("x + 2", f) Out[3]: True In [4]: GF("x + 2").multiplicative_order() Out[4]: 80
However, the element
is not a primitive element, as noted by its order being only 20.In [5]: galois.is_primitive_element("x + 1", f) Out[5]: False In [6]: GF("x + 1").multiplicative_order() Out[6]: 20