# Listing elements of (Z/nZ)*

I want to find all the elements of (Z/nZ)*. Is there a command for that ? For example if the user gives input 8, the the output will be {1,3,5,7}.

Listing elements of (Z/nZ)*

add a comment

3

You can use the method with a surprizing long but explicit name `list_of_elements_of_multiplicative_group`

:

```
sage: G = Zmod(8) ; G
Ring of integers modulo 8
sage: G.list_of_elements_of_multiplicative_group()
[1, 3, 5, 7]
```

If you want this set as a genuine group, you can do:

```
sage: G.unit_group()
Multiplicative Abelian group isomorphic to C2 x C2
```

Asked: **
2016-10-01 11:28:42 -0500
**

Seen: **334 times**

Last updated: **Oct 01 '16**

get multiplicative subgroup of Z/nZ

Group actions (e.g. on simplicial complexes, sets of tuples etc.)

Testing planarity on embedding gives wrong result

Problem with GeneralDihedralGroup constructor

Plot picewise function + infinity, error message

chromatic polynomial graph with loops

How to change the unreadable dark blue colour in the SageMath command line window under Windows-10?

Action of lattice automorphism group on discriminant group

How to get Sage 8.0 to plot matplotlib plots inline and typeset expressions on a Jupyter notebook?

Copyright Sage, 2010. Some rights reserved under creative commons license. Content on this site is licensed under a Creative Commons Attribution Share Alike 3.0 license.