= sagemath ff = GF(13) ff(3)^(-1) # the inverse element of 3 in a finite field with 13 elements is 9 R. = PolynomialRing(GF(2), 'y') # a binary polynomial ring G = y^64+y^3+y^0 # define a reduction polynomial S. = QuotientRing(R, R.ideal(G)) # define a quotient ring with the reduction polynomial assert S.is_field() S(x^1)^(-1) # inverse element of x^1