# How to obtain elements of dihedral group in GAP

I'd like to obtain a list of all permutations contained in D_n using GAP. E.g. for D_8 I've tried the following:

gap> G := DihedralGroup(8);
<pc group of size 8 with 3 generators>
gap> List(G);
[ <identity> of ..., f3, f2, f2*f3, f1, f1*f3, f1*f2, f1*f2*f3 ]


How can I obtain a list of actual permutations contained in D_8 instead?

## 1 Answer

maybe you could try this:

gap> D_8:=DihedralGroup(IsPermGroup,8);
Group([ (1,2,3,4), (2,4) ])
gap> Elements(D_8);
[ (), (2,4), (1,2)(3,4), (1,2,3,4), (1,3), (1,3)(2,4), (1,4,3,2), (1,4)(2,3) ]


You can find further information about IsPermGroup here

• Yes, that's what I was looking for! Thank you. Commented Sep 29, 2018 at 8:00
• More generally, you can use Image(IsomorphismPermGroup(G)) to find a permutation representation of a group G, and then get its elements. See also alex-konovalov.github.io/gap-lesson/01-command-line for further pointers to AsSSortedList and AsList. Also, accidentally this question is now shown as 400th question under the gap tag! Commented Sep 29, 2018 at 21:33