Ask Your Question

Revision history [back]

You instruct SageMath twice to create a finite field with $2^{n}$ elements with a primitive modulus. Effectively, each time this will call GF(2)['x'].irreducible_element(n, algorithm="primitive") to get such a modulus. This uses the Conway polynomial if available, and otherwise calls the ffprimroot function from PARI.

sage: exists_conway_polynomial(2, 151)
True
sage: exists_conway_polynomial(2, 152)
False

When you try out ffprimroot in PARI, you will see it is not deterministic; it returns a random primitive modulus. In total there are

sage: euler_phi(2^152 - 1)/152
18714123470861456900112662172997843377192960

different primitive moduli, so indeed you have a high probability of the comparison returning False.