> < ^ Date: Mon, 30 Jan 1995 10:04:00 -0500
> < ^ From: Steve Linton <sal@dcs.st-and.ac.uk >
< ^ Subject: Re: Subgroup listings...

Subject: Subgroup listings...

This may be an elementary question, but I am simply trying to get a listing of
all of the subgroups of a given group, say, D4. I feel like I am missing an
easy way to list all of the subgroups, but the following is the only way I've
found so far:

1) Define the group: d4:=Group((1,2,3,4));
2) Create a subgroup lattice for that group: latd4:=Lattice(d4);
3) Change the PrintLevel to display a representative subgroup for each
conjugacy class, as well as the conjugates of those representatives:
SetPrintLevel(latd4,3);
4) Print the classes: latd4.classes;

I feel like there must be an easier way than this. Any help is appreciated.

There doesn't seem to be a single function to this, but it is easy to write
one, since the conjugacy classes are domains, so we can apply the function
Elements:

gap> Subgroups := function(g)
> local l;
> l := Lattice(g);
> return Union(List(l.classes,Elements));
> end;
function ( g ) ... end
gap>

and we can test it with:

```gap> g := CyclicGroup(4);
Group( (1,2,3,4) )
gap> Subgroups(g);
[ Subgroup( Group( (1,2,3,4) ), [  ] ), Group( (1,2,3,4) ),
Subgroup( Group( (1,2,3,4) ), [ (1,3)(2,4) ] ) ]
gap>
```

The advantage of this method is that it returns a list of subgroups ready to
manipulate further. Be warned however, that for even moderately large groups
this list can become very long and very slow to compute. The elementary
abelian group of order 32, for example, has 374 subgroups, and the symmetric
group S6 has over 1000.

In these larger cases, there is almost always a way to avoid calculating
these lists in full, by using just conjugacy class representatives, or the
table of marks (see TableOfMarks in the manual).

Steve Linton

> < [top]