f=x^2+ 1 #if you don't tell sage what x is it assumes it's over the reals f.factor() g=y^2+1 R.=PolynomialRing(GF(2)) # GF(2) means the finite field with 2 elements f=x^2+1 f.factor() g=x^3+x^2+x+1 g.factor() (x+1)*(x^2+x+1) # this gives periods 3,3,1,1, accountinng for 2^3 states, se also the pictures x % g x^2 % g x^3 % g x^4 % g 36 %17 S=R.quotient_ring(f) # this constructs R/f, so the ring F_2[x]/f x S(x) # the output of this is barx, x reduced mod f S(x)^2 S=R.quotient_ring(x^3+x^2+x+1) # this is a more intersting polynomial S(x)^2 S(x)^3 S(x)^4 h=x^5+x^3+x^2+x+1 # I was looking for a good example factor(h) h=x^7+x+1 factor(h) h=x^7+x^5+x^3+x+1 # I was looking for a good example h=x^7+x^6+x^2+x+1 factor(h)