# Conditions for a composite order to only have a single group

I just learned the theorem that for every prime number $$p,$$ there is just one group of order $$p$$ down to isomorphism (the cyclic group $$\mathbb{Z}/p\mathbb{Z}$$).

But interestingly, the converse of this statement is not true, as there is just a single group of order $$15$$. This lead me to wonder: Is there a nice partial converse?

Consider a composite natural number $$m \in \mathbb{N}$$. I want to find the conditions for there to be multiple groups of order $$m$$. Since there is a cyclic group of every order, this is equivalent to finding a non-cyclic group of order $$m.$$ I have two conditions so far that imply multiple groups:

1. $$m$$ is even ($$>2$$)

Then $$m=2k$$ for some $$k>1$$. As the dihedral group $$D_k$$ has order $$2k=m$$ and is not cyclic, there are multiple groups of order m.

1. $$p^2 \mid m$$ for some prime $$p$$

Then let $$m = p^2k$$ for some $$k\in \mathbb{N}$$. Then the group $$(\mathbb{Z}/k\mathbb{Z}) \times (\mathbb{Z}/p^2\mathbb{Z})$$ and the group $$(\mathbb{Z}/k\mathbb{Z}) \times (\mathbb{Z}/p\mathbb{Z}) \times (\mathbb{Z}/p\mathbb{Z})$$ both have order $$p^2k = m$$ and are not isomorphic.

But these two conditions definitely don't cover all cases. Is there a nice condition for a composite number m such that there are multiple groups of order $$m$$?

There is a characterization, but I wouldn't call it simple. If we define $$f(n)$$ to be the number of isomorphism classes of groups of order $$n$$, we see that $$f(n) =1$$ if and only if $$\gcd(n,\phi(n)) = 1$$, where $$\phi$$ is the Euler totient function. More details about this can be found here (https://mathoverflow.net/questions/148731/for-which-n-is-there-only-one-group-of-order-n).