Easiest way to work in the multiplicative group of Zmod(n)
Given an integer $n$, one can define in SageMath the additive group $\mathbb Z/n\mathbb Z$ by
sage: Zn = Zmod(n) # or Integers(n)
Now, I would like to work in the multiplicative group $(\mathbb Z/n\mathbb Z)^*$. Of course, I can write
sage: G = [a for a in Zn if gcd(a,n) == 1] sage: Zn(4).multiplicative_order() 6
What I would like is an easier way of writing such a thing, such as:
sage: G = Zn.multiplicative_group() # does not exist! sage: G(4).order() 6
Does there exist something in SageMath to perform such kind of computations?