ASKSAGE: Sage Q&A Forum - RSS feedhttps://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Mon, 28 Sep 2015 18:24:45 +0200Easiest way to work in the multiplicative group of Zmod(n)https://ask.sagemath.org/question/29639/easiest-way-to-work-in-the-multiplicative-group-of-zmodn/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?B r u n oMon, 28 Sep 2015 18:24:45 +0200https://ask.sagemath.org/question/29639/