galois.irreducible_polys

galois.irreducible_polys(order, degree)

Returns all monic irreducible polynomials \(f(x)\) over \(\mathrm{GF}(q)\) with degree \(m\).

Parameters
  • order (int) – The prime power order \(q\) of the field \(\mathrm{GF}(q)\) that the polynomial is over.

  • degree (int) – The degree \(m\) of the desired irreducible polynomial.

Returns

All degree-\(m\) monic irreducible polynomials over \(\mathrm{GF}(q)\).

Return type

list

Notes

If \(f(x)\) is an irreducible polynomial over \(\mathrm{GF}(q)\) and \(a \in \mathrm{GF}(q) \backslash \{0\}\), then \(a \cdot f(x)\) is also irreducible. In addition to other applications, \(f(x)\) produces the field extension \(\mathrm{GF}(q^m)\) of \(\mathrm{GF}(q)\).

Examples

All monic irreducible polynomials over \(\mathrm{GF}(2)\) with degree \(5\).

In [1]: galois.irreducible_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 irreducible polynomials over \(\mathrm{GF}(3^2)\) with degree \(2\).

In [2]: galois.irreducible_polys(3**2, 2)
Out[2]: 
[Poly(x^2 + 3, GF(3^2)),
 Poly(x^2 + 5, GF(3^2)),
 Poly(x^2 + 6, GF(3^2)),
 Poly(x^2 + 7, GF(3^2)),
 Poly(x^2 + x + 3, GF(3^2)),
 Poly(x^2 + x + 4, GF(3^2)),
 Poly(x^2 + x + 7, GF(3^2)),
 Poly(x^2 + x + 8, GF(3^2)),
 Poly(x^2 + 2x + 3, GF(3^2)),
 Poly(x^2 + 2x + 4, GF(3^2)),
 Poly(x^2 + 2x + 7, GF(3^2)),
 Poly(x^2 + 2x + 8, GF(3^2)),
 Poly(x^2 + 3x + 1, GF(3^2)),
 Poly(x^2 + 3x + 2, GF(3^2)),
 Poly(x^2 + 3x + 6, GF(3^2)),
 Poly(x^2 + 3x + 7, GF(3^2)),
 Poly(x^2 + 4x + 4, GF(3^2)),
 Poly(x^2 + 4x + 5, GF(3^2)),
 Poly(x^2 + 4x + 6, GF(3^2)),
 Poly(x^2 + 4x + 8, GF(3^2)),
 Poly(x^2 + 5x + 1, GF(3^2)),
 Poly(x^2 + 5x + 2, GF(3^2)),
 Poly(x^2 + 5x + 3, GF(3^2)),
 Poly(x^2 + 5x + 5, GF(3^2)),
 Poly(x^2 + 6x + 1, GF(3^2)),
 Poly(x^2 + 6x + 2, GF(3^2)),
 Poly(x^2 + 6x + 6, GF(3^2)),
 Poly(x^2 + 6x + 7, GF(3^2)),
 Poly(x^2 + 7x + 1, GF(3^2)),
 Poly(x^2 + 7x + 2, GF(3^2)),
 Poly(x^2 + 7x + 3, GF(3^2)),
 Poly(x^2 + 7x + 5, GF(3^2)),
 Poly(x^2 + 8x + 4, GF(3^2)),
 Poly(x^2 + 8x + 5, GF(3^2)),
 Poly(x^2 + 8x + 6, GF(3^2)),
 Poly(x^2 + 8x + 8, GF(3^2))]