5
$\begingroup$

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.

$\endgroup$

2 Answers 2

3
$\begingroup$

More succinct is:

Number(L,c->IsAbelian(c) and Exponent(c)=n and Order(c)=m);
$\endgroup$
1
  • 4
    $\begingroup$ Also, if you want a list of elements with the desired properties, you can use "Filtered(L, c->IsAbelian(c) and Exponent(c)=n and Order(c)=m);". $\endgroup$ Aug 7, 2013 at 6:44
2
$\begingroup$

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.

$\endgroup$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .