# The $p$-groups of Order Dividing $p^7$

Magma contains the means to construct all $p$-groups of order $p^n$ where $n\le 7$. This section describes the functions for accessing these constructions. The data used in the constructions was supplied by Hans Ulrich Besche, Bettina Eick, Eamonn O’Brien, Mike Newman and Michael Vaughan-Lee [[Besche and Eick, 1999](../../references.md#cite-besche-eick-constr), [Besche and Eick, 1999](../../references.md#cite-besche-eick-1000), [Besche and Eick, 2001](../../references.md#cite-besche-eick-order-qnp), [Besche *et al.*, 2001](../../references.md#cite-besche-eick-obrien-order-2000), [M.F. Newman and Vaughan-Lee, 2004](../../references.md#cite-newman-ob-vl-04), [O'Brien, 1990](../../references.md#cite-obrien-pgroup), [O'Brien, 1991](../../references.md#cite-obrien-groups-256), [O'Brien and Vaughan-Lee, 2005](../../references.md#cite-ob-vl-05)].

## `SearchPGroups(p, n: parameters): RngIntElt, RngIntElt -> SeqEnum`

```magma
Rank  : SetEnum                      Default: {1,... n}
Class : SetEnum                      Default: {1,... n}
Select: Program                      Default: true
Limit : RngIntElt                    Default: 0
```

Produce a sequence of groups of order $p^n$ satisfying the conditions specified by the following parameters. The restrictions on the order are $n \le 7$ or $p=2$ and $n\le 9$.

All groups returned will have Frattini quotient rank in `Rank`. This parameter may also be set to a single integer.

All groups returned will have $p$-class in `Class`. This parameter may also be set to a single integer.

The parameter must be set to a program returning either `true` or `false` when given a $p$-group satisfying the above conditions. All groups $G$ returned will then satisfy `Select(G) eq true`.

If `Limit` is set to a positive number $n$, then the program may end its search and return when there are at least $n$ groups found.

## `CountPGroups(p, n: parameters): RngIntElt, RngIntElt -> SeqEnum`

Count the number of groups of order $p^n$ satisfying the conditions specified by the parameters. The parameters are the same as for `SearchPGroups`, except that the `Limit` parameter is ignored.

## `Example: p7 (ex-1addd3)`

We search the groups of order $19^7$ for specific examples. There are, in total, 9380741 groups with this order. We start with a search for those of rank 5, class 3, and exponent 19. Since we do not set the `Limit` parameter, we will get a sequence containing all the examples.

```magma
> time Q := SearchPGroups(19, 7:Rank := 5, Class := 3,
>    Select := func<G|IsPrime(Exponent(G))> );
Time: 0.050
> #Q;
4
> Q[1];
GrpPC of order 893871739 = 19^7
PC-Relations:
  $.2^$.1 = $.2 * $.6,
  $.6^$.1 = $.6 * $.7

```

This time we limit the number returned.

```magma
> time    Q := SearchPGroups(19, 7:Rank := 4, Class := {3,4},
>    Select := func<G|IsPrime(Exponent(G))>, Limit := 5);
Time: 13.090
> #Q;
5
> [pClass(G):G in Q];
[ 3, 3, 3, 3, 3 ]
> time    Q4 := SearchPGroups(19, 7:Rank := 4, Class := 4,
>   Select := func<G|IsPrime(Exponent(G))>, Limit := 5);
Time: 0.150
> #Q4;
6

```

Note that the limit is not always adhered to exactly. We can also count the number of groups with our property.

```magma
> time CountPGroups(19, 7:Rank := 4, Class := {3,4},
>   Select := func<G|IsPrime(Exponent(G))>);
Time: 334.720
43
> time CountPGroups(19, 7:Rank := 4, Class := 4,
>    Select := func<G|IsPrime(Exponent(G))>);
10
Time: 0.310

```
