Dear GAP Forum,


On 1 Jul 2010, at 19:11, Benjamin Sambale wrote:

> Size(Filtered(G,x->Order(x)=n)); counts the elements of order n in the group 
> G.
> 

You can simplify this a little to

Number(G, x-> Order(x) = n)

and this will work quite efficiently for smaller groups.

For larger (and nonabelian) groups it would be more sensible to use the  
conjugacy structure of the group. Something like:

Sum(Filtered(ConjugacyClasses(G), c-> Order(Representative(c)) = n), Size)

works well. For example for G = M_22 and n =4 this is some 50 times faster than 
the direct approach.

Finally, for the largest examples it might be best to factorise n into prime 
powers and use the Sylow subgroups to find representatives of all the conjugacy 
classes of elements of the appropriate prime power orders. Then, aving 
enumerated these elements, the number of elements of order n is simply the 
product.

        Steve


> Sandeep Murthy schrieb:
>> Hello.
>> 
>> Is there a direct function in GAP for counting all elements
>> in a group of a given order?
>> 
>> Sandeep.
>> 
>> _______________________________________________
>> Forum mailing list
>> Forum@mail.gap-system.org
>> http://mail.gap-system.org/mailman/listinfo/forum
>> 
>>  
> 
> _______________________________________________
> Forum mailing list
> Forum@mail.gap-system.org
> http://mail.gap-system.org/mailman/listinfo/forum


_______________________________________________
Forum mailing list
Forum@mail.gap-system.org
http://mail.gap-system.org/mailman/listinfo/forum

Reply via email to