# [GAP Forum] [GAP Support] I think I found a bug.

Max Neunhoeffer neunhoef at mcs.st-and.ac.uk
Tue Jul 13 16:01:21 BST 2010

```Dear Lisette,

I think the "logic" comes from the orbit algorithm. It works about as
follows:

l := [a];
i := 1;
while i <= Length(l) do
for g in gens do
if not(l[i]^g in l) then
fi;
od;
i := i + 1;
od;

Of course the GAP library has an optimised version of this, but this
basically should explain the order of the things in the list you see.

I think SymmetricGroup(9) will have
(1,2,3,4,5,6,7,8,9) and (1,2)
as generators, so the output you sent is exactly what I would expect
from the above algorithm.

Cheers,
Max.

On Tue, Jul 13, 2010 at 03:21:42PM +0200, Lisette Brillemans wrote:
> Dear Max,
>
> You're right. If you look at it this way you can say the answer given is
> of course entirely correct. However I am still wondering why the
> ordering of the second line in my example is somehow "unlogical"
> compared to the other lines. Is there some inconsistency in the
> algorithm? (I mean, why only when a = 2?)
> But if that's not the case then I apologize.
>
> Best regards,
>
> Lisette
>
>
> > Dear Lisette,
> >
> > as far as I see there is nothing incorrect. The documentation of
> > "Orbit" says that the result is the *list of all images* and not the
> > *set of all images*. Therefore it is OK that the list is not sorted.
> > The order of the elements you see depends on the starting point and
> > the generators of your group in general. Also, it is not guaranteed by
> > the documentation.
> >
> > If you need the orbit as a set just use
> >   Set(Orbit(S,a))
> >
> > I hope this is useful, if there are any other questions please do not
> > hesitate to ask again.
> >
> > Best regards,
> >   Max Neunhoeffer
> >
> > On Tue, Jul 13, 2010 at 01:28:43PM +0200, Lisette Brillemans wrote:
> > > LS
> > >
> > >
> > > I'm using the latest version of GAP on linux and have read all the
> > > bugfixes but didn't find this one:
> > >
> > > If you type this:
> > >
> > >
> > > S:=SymmetricGroup(9);
> > > for a in [1..9] do
> > >  Print(Orbit(S,a),"\n");
> > > od;
> > >
> > > The output is as follows:
> > >
> > > [1,2,3,4,5,6,7,8,9]
> > > [2,3,1,4,5,6,7,8,9]
> > > [3,4,5,6,7,8,9,1,2]
> > > [4,5,6,7,8,9,1,2,3]
> > > [5,6,7,8,9,1,2,3,4]
> > > [6,7,8,9,1,2,3,4,5]
> > > [7,8,9,1,2,3,4,5,6]
> > > [8,9,1,2,3,4,5,6,7]
> > > [9,1,2,3,4,5,6,7,8]
> > >
> > > The problem is the second line:
> > >
> > > [2,3,1,4,5,6,7,8,9]
> > >
> > > Which, according to me, is incorrect.
> > >
> > > But apart from that GAP is a splendid program which possibilities still
> > > surprise me everyday.
> > >
> > > With regards.
> > >
> > > Lisette Brillemans
> > > Rotterdam, Holland
> > >
> > >
> > > _______________________________________________
> > > Support mailing list
> > > Support at gap-system.org
> > > http://mail.gap-system.org/mailman/listinfo/support
> >
>
>

--
Max Neunhoeffer              http://www-groups.mcs.st-and.ac.uk/~neunhoef/
> > > > > > > > > > >  May the Source be with you! < < < < < < < < < < < <
The University of St Andrews is a registered Scottish charity: No SC013532

```