Ask Your Question

Revision history [back]

Do you mean

sage: from itertools import product
sage: GF2x = GF(2)['x']
sage: for coeffs in product(GF(2), repeat=7):
....:     p = GF2x(coeffs + (1,))
....:     if p.is_irreducible():
....:         print(p)
x^7 + x^6 + 1
x^7 + x^4 + 1
x^7 + x^6 + x^5 + x^4 + 1
x^7 + x^3 + 1
x^7 + x^5 + x^4 + x^3 + 1
x^7 + x^6 + x^5 + x^2 + 1
x^7 + x^6 + x^4 + x^2 + 1
x^7 + x^4 + x^3 + x^2 + 1
x^7 + x^6 + x^5 + x^4 + x^3 + x^2 + 1
x^7 + x + 1
x^7 + x^6 + x^4 + x + 1
x^7 + x^6 + x^3 + x + 1
x^7 + x^5 + x^3 + x + 1
x^7 + x^5 + x^2 + x + 1
x^7 + x^6 + x^5 + x^4 + x^2 + x + 1
x^7 + x^3 + x^2 + x + 1
x^7 + x^6 + x^5 + x^3 + x^2 + x + 1
x^7 + x^5 + x^4 + x^3 + x^2 + x + 1

Do you mean

sage: from itertools import product
sage: GF2x = GF(2)['x']
sage: for coeffs in product(GF(2), repeat=7):
repeat=8):
....:     p = GF2x(coeffs + (1,))
....:     if p.is_irreducible():
....:         print(p)
x^7 + x^6 + 1
x^7 + x^4 + 1
x^7 + x^6 + x^5 + x^4 + 1
x^7 + x^3 + 1
x^7 + x^5 + x^4 + x^3 + 1
x^7 + x^6 + x^5 + x^2 + 1
x^7 + x^6 + x^4 + x^2 + 1
x^7 + x^4 + x^3 + x^2 + 1
x^7 + x^6 + x^5 + x^4 + x^3 + x^2 + 1
x^7 + x + 1
x^7 + x^6 + x^4 + x + 1
x^7 + x^6 + x^3 + x + 1
x^7 + x^5 + x^3 + x + 1
x^7 + x^5 + x^2 + x + 1
x^7 + x^6 + x^5 + x^4 + x^2 + x + 1
x^7 + x^3 + x^2 + x + 1
x^7 + x^6 + x^5 + x^3 + x^2 + x + 1
x^7 ....:         
x^8 + x^7 + x^5 + x^4 + 1
x^8 + x^6 + x^5 + x^4 + 1
x^8 + x^7 + x^5 + x^3 + 1
x^8 + x^6 + x^5 + x^3 + 1
x^8 + x^5 + x^4 + x^3 + 1
x^8 + x^7 + x^6 + x^5 + x^4 + x^3 + 1
x^8 + x^6 + x^5 + x^2 + 1
x^8 + x^7 + x^6 + x^5 + x^4 + x^2 + 1
x^8 + x^7 + x^3 + x^2 + 1
x^8 + x^6 + x^3 + x^2 + 1
x^8 + x^5 + x^3 + x^2 + 1
x^8 + x^4 + x^3 + x^2 + 1
x^8 + x^7 + x^6 + x^4 + x^3 + x^2 + 1
x^8 + x^7 + x^5 + x^4 + x^3 + x^2 + 1
x^8 + x^7 + x^6 + x + 1
x^8 + x^7 + x^5 + x + 1
x^8 + x^6 + x^5 + x + 1
x^8 + x^7 + x^6 + x^5 + x^4 + x + 1
x^8 + x^7 + x^3 + x + 1
x^8 + x^5 + x^3 + x + 1
x^8 + x^4 + x^3 + x + 1
x^8 + x^6 + x^5 + x^4 + x^3 + x + 1
x^8 + x^7 + x^2 + x + 1
x^8 + x^7 + x^6 + x^5 + x^2 + x + 1
x^8 + x^7 + x^6 + x^4 + x^2 + x + 1
x^8 + x^6 + x^5 + x^4 + x^2 + x + 1
x^8 + x^7 + x^6 + x^3 + x^2 + x + 1
x^8 + x^7 + x^4 + x^3 + x^2 + x + 1
x^8 + x^6 + x^4 + x^3 + x^2 + x + 1
x^8 + x^5 + x^4 + x^3 + x^2 + x + 1

Some explanations:

  • A polynomial defines GF(2^8) if and only if it has degree 8 and is irreducible
  • the product from itertools allow you to run all through all elements of the Cartesian product GF(2)^8