In GAP, we can generate permutations using, for example
alpha:=(1,2,3,4,5);
But, this method is not usable if we want to input the permutation $$(1,2,\ldots,n)$$ for some variable $n$.
It is possible to use
alpha:=PermList(List([1..n],i->(i mod n)+1));
for variable $n$, but this feels clumsy.
Question: Is there a better way to input an $n$-cycle in GAP?
Thank you, it's a good question. In brief, your suggestion to use
PermListis right, but its argument may be assembled faster:Now a bit longer version of the reply with timings. First, another alternative is
MappingPermListList:Nevertheless, your suggestion with
PermListis already slightly faster:However, one could do even better, avoiding writing
mod n)+1and usingConcatenationinstead. Then the performance is ~20 times faster:Summarising, I'd recommend to use
PermListin this particular case when one needs to create a cycle $(1,2,...n)$. In a general case, one should choose betweenPermListandMappingPermListListdependently on the data available.P.S. Note that the naive approach to multiply transpositions does not scale well at all: