Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

List members of each subgroup of integers modulo n

Hi - I am new to Sage so apologies if this is a dumb question.

For a given n, I would like to print out the list of subgroups of the multiplicative group modulo n as a list of the members of the subgroup. Here's one of the things I have tried so far:

R = Zmod(20) grouplist = R.multiplicative_subgroups() for subgroup in grouplist: print subgroup (11, 17) (9, 11) (3,) (11,) (19,) (17,) (9,) ()

As you can see, this gives me the generators of the sub-groups, but what I'd like is the complete list of members of the subgroup for each subgroup. Something along these lines - where members() is the method I would like, but don't know if it exists!:

R = Zmod(20) grouplist = R.multiplicative_subgroups() for subgroup in grouplist: print subgroup.members() (1, 3, 7, 9, 11, 13, 17, 19) (1, 9, 11, 19) (1, 3, 7, 9) (1, 11) (1, 19) (1, 9, 13, 17) (1, 9) (1)

Thanks for any help, Martin