# GAP:SortArithmeticFunctionSizes

This article is about a GAP function.

This GAP function is

not in-built: you need to copy the code on this page to define the function.

## Definition

### Function type

The function takes three arguments, the first of which is supposed to be a prime number, the second one a nonnegative integer, and the third one an arithmetic function on groups (which should be well-defined for any group of prime power order).

### Behavior

The call:

`SortArithmeticFunctionSizes(p,n,f)`

behaves as follows if is a prime number, a nonnegative integer, and an arithmetic function on groups of prime power order that gives output that is a nonnegative integer less than or equal to for every group of size :

It outputs a list of pairs (each pair itself implemented as a list). The first elements of the pair go from to , adn the second elements of the pair give the number of groups of order for which the arithmetic function takes the value that is the first element in the pair.

## Method

### Code

SortArithmeticFunctionSizes := function(p,n,f) local L,M; L := IdsOfAllSmallGroups(p^n); M := SortedList(List(L,x -> f(SmallGroup(x)))); return(List([0..n],i -> [i,Length(Filtered(M,x -> x = i))])); end;;

## Applications

See groups of order 2^n#Arithmetic functions, groups of order 3^n#Arithmetic functions, and groups of order 5^n#Arithmetic functions to see how this function is used to generate overall statistical information about groups of prime power order (to see the use of these functions, click "SHOW MORE" after each of the tables).