Thank you, it's a good question. In brief, your suggestion to use PermList is right, but its argument may be assembled faster:
alpha:=PermList(Concatenation([2..n],[1]));
Now a bit longer version of the reply with timings. First, another alternative is MappingPermListList:
gap> n:=5;;MappingPermListList([1..n],Concatenation([2..n],[1]));
(1,2,3,4,5)
Nevertheless, your suggestion with PermList is already slightly faster:
gap> n:=100000;;for i in [1..100] do alpha:=PermList(List([1..n],i->(i mod n)+1));od;time;
984
gap> n:=100000;;for i in [1..100] do alpha:=MappingPermListList([1..n],Concatenation([2..n],[1]));od;time;
1361
However, one could do even better, avoiding writing mod n)+1 and using Concatenation instead. Then the performance is ~20 times faster:
gap> n:=100000;;for i in [1..100] do alpha:=PermList(Concatenation([2..n],[1]));od;time;
47
Summarising, I'd recommend to use PermList in this particular case when one needs to create a cycle $(1,2,...n)$. In a general case, one should choose between PermList and MappingPermListList dependently on the data available.
P.S. Note that the naive approach to multiply transpositions does not scale well at all:
gap> n:=5;; alpha:=(1,2);;for j in [3..n] do alpha:=alpha*(1,j);od; alpha;
(1,2,3,4,5)
gap> n:=100000;; alpha:=(1,2);;for j in [3..n] do alpha:=alpha*(1,j);od; time;
14429
->is a GAP shortcut for one-argument function.i->(i mod n)+1?creates a functionf(i)such thatifrom[1..n-1]is mapped toi+1, andnis mapped to1. On other inputs it will act appropriately (but in the example above it is called forifrom[1..n]). P.S. there should be no space between @ and username to ping, I've just occasionally discovered your question. – Olexandr Konovalov Jan 31 '14 at 08:04