TITLE: Is there order to the number of groups of different orders?
QUESTION [8 upvotes]: I was always struck by how uncharacteristically erratic the behavior of the following function is:
$f: \mathbb{N} \rightarrow \mathbb{N}$ given by $f(n):=$ number of isomorphism classes of groups of order $n$.
I blame this on the introduction of the unnatural idea of looking at the size of the group. Why would we? The same is true in Algebraic Geometry: curves are nicer than surfaces for an arbitrary reason. Looking at the dimension introduces an unnatural agent in the mix.
My question is this:
What is the most "natural" statement (and less preferably: viewpoint) you've ever seen about this $f$? I bar asymptotic statements as inherently unnatural (unless you can convince me otherwise). To open the floor the widest, I'll put a CW stamp on this question.

REPLY [2 votes]: The most general statement that I have seen is due to Holder and gives the following result: if $n$ is squarefree, and if $f_p(n)$ is the number of primes $q$ with $q \mid n$ and $p \mid q-1$, then the number of groups of order $n$ is given by $$g(n) = \sum_{d\mid n}\prod_{p\mid d,\;d > 1} \frac{p^{f_p(n/d)}-1}{p-1}.$$
This formula is nic ein that it is exact; of course, the asymptotics here are very hard to extract, and given that there tend to be more groups of non-squarefree order than of squarefree order it is not terribly useful in asymptotic estimates.