to_check=[5, 7,
0b10000001001, 0b10000001111,
0x18005, 0x11021, 0x1C867,
0x104c11db7, 0x11EDC6F41, 0x1741B8CD7, 0x132583499, 0x1814141AB,
0x100000000000000000000000000000087]
def chk(p):
k.<a> = GF(2^129)
x=k.fetch_int(p)
y=x.polynomial()
return (hex(p), y.is_irreducible())
list(map(chk, to_check))
def factor_poly(p):
k.<a> = GF(2^129)
x=k.fetch_int(p)
y=x.polynomial()
print ("input poly:", y)
if y.is_irreducible():
print ("prime")
else:
print (y.factor())
factor_poly(0x18005)
factor_poly(0x142F0E1EBA9EA3693)
factor_poly(0x100000000000000000000000000000087)
factor_poly(0x132583499)
factor_poly(0x11021)
factor_poly(0x39)