galois.primitive_polys¶
- galois.primitive_polys(characteristic, degree)¶
Returns all monic primitive polynomials \(f(x)\) over \(\mathrm{GF}(p)\) with degree \(m\).
- Parameters
- Returns
All degree-\(m\) monic primitive polynomials over \(\mathrm{GF}(p)\).
- Return type
Notes
In addition to other applications, \(f(x)\) produces the field extension \(\mathrm{GF}(p^m)\) of \(\mathrm{GF}(p)\). Since \(f(x)\) is primitive, \(x\) is a primitive element \(\alpha\) of \(\mathrm{GF}(p^m)\) such that \(\mathrm{GF}(p^m) = \{0, 1, \alpha, \alpha^2, \dots, \alpha^{p^m-2}\}\).
Examples
All monic primitive polynomials over \(\mathrm{GF}(2)\) with degree \(5\).
In [1]: galois.primitive_polys(2, 5) Out[1]: [Poly(x^5 + x^2 + 1, GF(2)), Poly(x^5 + x^3 + 1, GF(2)), Poly(x^5 + x^3 + x^2 + x + 1, GF(2)), Poly(x^5 + x^4 + x^2 + x + 1, GF(2)), Poly(x^5 + x^4 + x^3 + x + 1, GF(2)), Poly(x^5 + x^4 + x^3 + x^2 + 1, GF(2))]
All monic primitive polynomials over \(\mathrm{GF}(3)\) with degree \(4\).
In [2]: galois.primitive_polys(3, 4) Out[2]: [Poly(x^4 + x + 2, GF(3)), Poly(x^4 + 2x + 2, GF(3)), Poly(x^4 + x^3 + 2, GF(3)), Poly(x^4 + x^3 + x^2 + 2x + 2, GF(3)), Poly(x^4 + x^3 + 2x^2 + 2x + 2, GF(3)), Poly(x^4 + 2x^3 + 2, GF(3)), Poly(x^4 + 2x^3 + x^2 + x + 2, GF(3)), Poly(x^4 + 2x^3 + 2x^2 + x + 2, GF(3))]