# Revision history [back]

### 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]


What I would like is an easier way of writing such a thing, such as:

sage: G = Zn.multiplicative_group() #does not exist!


And then, I could for instance write something like:

### 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 # does not exist!
sage: G(4).order()
6


And then, I could for instance write Does there exist something like:in SageMath to perform such kind of computations?

 3 retagged FrédéricC 5151 ●3 ●43 ●112

### 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?

 4 retagged tmonteil 27363 ●31 ●203 ●515 http://wiki.sagemath.o...

### 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?

 5 retagged tmonteil 27363 ●31 ●203 ●515 http://wiki.sagemath.o...

### 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?