# [GAP Forum] How many elements of SymmetricGroup can be representedby GAP ?

Stefan Kohl kohl at mathematik.uni-stuttgart.de
Mon Jul 12 16:50:39 BST 2004

```Dear Forum,

Kang ByoungKwan wrote:

> I met the problem about limit # of representing elements of symmetric group.
> This is my partial code for using all elements of symmetric group
>
> gap>idx:=10;
> gap>G:=SymmetricGroup(idx);
> gap>sub:=Elements(G);
>
> gap: cannot extend the workspace any more
> gap: Press <Enter> to end program
>
> If I write idx:=9 then the above program acts well. But, If idx:=10 then they break
> Is there some solutions for solving this problem ?

There are basically two solutions to this problem:

- If you just want to loop over all group elements, then you can write

for g in SymmetricGroup(10) do

< your code, i.e. what you want to do with the group element >

od;

- If you want to have an object which behaves like a list of all group elements,
then you can write

l := Enumerator(SymmetricGroup(10));

This does not actually compute all group elements (thus does not need much memory),
but can be used as if it would be a list of all group elements, e.g. you can write

gap> l[1];
()
gap> l[1000000];
(1,9)(3,10,6,8,7,4,5)
gap> l{[785433..785438]};
[ (1,2,10,3,9,4,8,7,5), (1,3,9,4,8,7,5), (1,4,8,7,5)(3,9,10),
(1,5)(3,9,4,8,7,10), (1,6,10,3,9,4,8,7,5), (1,7,5)(3,9,4,8,10) ]

Hope this helps,

Stefan Kohl

```