Extracting Information from Lists in GAP

207 Views Asked by At

If I have a list $L$ in GAP, and a certain list of properties $a,b,c$, how can I count the the number of elements in my list that have all three properties? I've searched the manual (chapter on Lists), but haven't found the function I'm looking for.

Specifically, if $G$ is a finite group, the list I am working with is:

L:=List(ConjugacyClassesSubgroups(G),c->Representative(c));

I'd like to count the elements in this list that would return true for all three of the following queries:

IsAbelian(c)
Exponent(c)=n
Order(c)=m

for specified values of $m$ and $n$. I'd like to avoid going through a list and counting 'trues,' so it would be great if GAP could just give me a number.

2

There are 2 best solutions below

1
On BEST ANSWER

More succinct is:

Number(L,c->IsAbelian(c) and Exponent(c)=n and Order(c)=m);
0
On

I just answered my own question. Here it is if anyone is interested.

SizeBlist(List(L,c->IsAbelian(c) and Exponent(c)=n and Order(c)=m))

SizeBlist counts the true entries in a Boolean list, and due to the use of 'and' the nested list will only have a true value if the representative subgroup satisfies all three conditions.