# Revision history [back]

You can define the ring of integers modulo n and then its unit group:

sage: n = 10
sage: R = IntegerModRing(n)
sage: G = R.unit_group()
sage: G
Multiplicative Abelian group isomorphic to C4
sage: G.order()
4
sage: G.inject_variables()
Defining f
sage: f^2
f^2
sage: f.order()
4
sage: (f^2).order()
2


You can define use the ring unit group of integers modulo n and then its unit group:your ring:

sage: n = 10
sage: R Zn = IntegerModRing(n)
Zmod(n)
sage: G = R.unit_group()
Zn.unit_group()
sage: G
Multiplicative Abelian group isomorphic to C4
sage: G.order()
4
sage: G.inject_variables()
Defining f
sage: f^2
f^2
sage: f.order()
4
sage: (f^2).order()
2


You can use the unit group of your ring:

sage: n = 10
sage: Zn = Zmod(n)
sage: G = Zn.unit_group()
sage: G
Multiplicative Abelian group isomorphic to C4
sage: G.order()
4
sage: G.inject_variables()
Defining f
sage: f^2
f^2
sage: f.order()
4
sage: (f^2).order()
2


This group G comes with and embedding into Zn:

sage: Zn(f) 7 sage: Zn(f^2) 9 sage: Zn(f^3) 3 sage: Zn(f^4) 1 sage: Zn(f^5) 7

You can use the unit group of your ring:

sage: n = 10
sage: Zn = Zmod(n)
sage: G = Zn.unit_group()
sage: G
Multiplicative Abelian group isomorphic to C4
sage: G.order()
4
sage: G.inject_variables()
Defining f
sage: f^2
f^2
sage: f.order()
4
sage: (f^2).order()
2


This group G comes with and embedding into Zn:

sage: Zn(f)
7
sage: Zn(f^2)
9
sage: Zn(f^3)
3
sage: Zn(f^4)
1
sage: Zn(f^5)
77