Processing math: 100%
Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

asked 9 years ago

B r u n o gravatar image

Easiest way to work in the multiplicative group of Zmod(n)

Given an integer n, one can define in SageMath the additive group Z/nZ by

sage: Zn = Zmod(n) # or Integers(n)

Now, I would like to work in the multiplicative group (Z/nZ). 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:

click to hide/show revision 2
No.2 Revision

Easiest way to work in the multiplicative group of Zmod(n)

Given an integer n, one can define in SageMath the additive group Z/nZ by

sage: Zn = Zmod(n) # or Integers(n)

Now, I would like to work in the multiplicative group (Z/nZ). 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?

click to hide/show revision 3
retagged

updated 8 years ago

FrédéricC gravatar image

Easiest way to work in the multiplicative group of Zmod(n)

Given an integer n, one can define in SageMath the additive group Z/nZ by

sage: Zn = Zmod(n) # or Integers(n)

Now, I would like to work in the multiplicative group (Z/nZ). 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?

Easiest way to work in the multiplicative group of Zmod(n)

Given an integer n, one can define in SageMath the additive group Z/nZ by

sage: Zn = Zmod(n) # or Integers(n)

Now, I would like to work in the multiplicative group (Z/nZ). 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?

Easiest way to work in the multiplicative group of Zmod(n)

Given an integer n, one can define in SageMath the additive group Z/nZ by

sage: Zn = Zmod(n) # or Integers(n)

Now, I would like to work in the multiplicative group (Z/nZ). 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?