How to use GAP/magma to list all the elements of some order in a finite group?

713 Views Asked by At

How to use GAP/magma to list all the elements of some order in a finite group? For example, let $G\cong \mathbb{Z}_2\times \mathbb{Z}_{24}$, how to use GAP/magma to list all the elements of order $24$?

1

There are 1 best solutions below

0
On BEST ANSWER
gap> group:=CyclicGroup(24);
<pc group of size 24 with 4 generators>
gap> elems:=Filtered(Elements(group),x->Order(x)=24);
[ f1, f1*f3, f1*f2*f3, f1*f2*f4, f1*f3*f4, f1*f4^2, f1*f2*f4^2, f1*f2*f3*f4^2 ]