> < ^ Date: Fri, 15 Nov 1996 10:24:54 +0100
> < ^ From: Sebastian Egner <sebastian.egner@philips.com >
^ Subject: Order distribution of a group

Dear GAP-Forum,

Pat Callahan wrote in his e-mail

> GAP-forum,
> Is there a simple way to create a list of how many elements of each
order
> there are for a given group? Thanks,
> Pat Callahan

Here is quick solution :-)

# Order distribution of a group (for Pat Callahan)
# Sebastian Egner, 15.11.96, GAP v3.4

#F OrderDistributionGroup( <group> )
#F returns the distribution of the orders of the elements of
#F <group> as a sorted list of pairs [<order>, <frequency>].
#F (The function uses ConjugacyClasses.)
#F

OrderDistributionGroup := function ( G )
local cs, cs1, i;

```cs :=
List(
ConjugacyClasses(G),
C -> [ Order(G, Representative(C)), Size(C) ]
);
```
```  Sort(cs);
cs1 := [ cs ];
for i in [2..Length(cs)] do
if cs[i] = cs1[Length(cs1)] then
cs1[Length(cs1)] := cs1[Length(cs1)] + cs[i];
else
fi;
od;
return cs1;
end;

- - -
Sebastian Egner
Institut f■r Algorithmen und Kognitive Systeme
Universitðt Karlsruhe
Am Fasanengarten 5
D-76128 Karlsruhe
Tel.    +49 721 608 4304 / +49 721 96400 14
Fax.    +49 721 69 68 93
e-mail  egner@informatik.uni-karlsruhe.de
```

> < [top]