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.Thu, 30 Jul 2020 08:39:34 +0200What construct for cyclic group?https://ask.sagemath.org/question/52750/what-construct-for-cyclic-group/What is the proper Sage construct for working with cyclic group $\mathbb{Z} / n \mathbb{Z}$ ? I cannot see any in group theory manual page. Yes, we have `Integers(n)`, but it cannot be asked like a group about, say, `subgroup()`.Wed, 29 Jul 2020 21:16:41 +0200https://ask.sagemath.org/question/52750/what-construct-for-cyclic-group/Answer by philipp7 for <p>What is the proper Sage construct for working with cyclic group $\mathbb{Z} / n \mathbb{Z}$ ? I cannot see any in group theory manual page. Yes, we have <code>Integers(n)</code>, but it cannot be asked like a group about, say, <code>subgroup()</code>.</p>
https://ask.sagemath.org/question/52750/what-construct-for-cyclic-group/?answer=52751#post-id-52751You can use the method `CyclicPermutationGroup(n)`. This will create a cyclic group of given order. Then you can apply all the usual group-theory methods, e.g.
sage: G = CyclicPermutationGroup(8)
sage: G.is_cyclic()
True
sage: genG = G.gen()
sage: genG
(1,2,3,4,5,6,7,8)
One problem is, that the elements are now represented as permutations and not in the "usual way" as integers $0,...,n-1$. However, if you want the element in $G$ which corresponds to $i \in \mathbb{Z}_n$ you can use `genG^i`. Thu, 30 Jul 2020 08:39:34 +0200https://ask.sagemath.org/question/52750/what-construct-for-cyclic-group/?answer=52751#post-id-52751