Number of groups of a given order In general, for what $n$ do there exist two groups of order $n$? How about three groups of order $n$?
I know that if $n$ is prime, there only exists one group of order $n$, by Lagrange's Theorem, but how do you classify all other such $n$ that have $2, 3, 4, ...$ groups?
This question came to me during a group theory class, when we were making a table of groups of order $n$. For instance, all groups of order $4$ are isomorphic to either $C_4$ or $C_2\times C_2$. 
 A: A partial result: there exists a unique group of order $n$ (i.e. the cyclic group) if and only if $(n,\phi(n)) = 1$, where $\phi$ is the Euler phi function and $(a,b) = \operatorname{gcd}(a,b)$. This is certainly satisfied when $n$ is a prime, but when $n = 15$ we have $\phi(n) = 8$, and since $(15,8) = 1$ there is a unique group of order $15$, even though $15$ is not prime. A proof can be found here.
A: Here are two possibilities for $n$ for which there are precisely two groups of order $n$.


*

*$n=p_1p_2 \cdots p_n$ for some $n \ge 2$ and distinct primes $p_i$, such that there is exactly one pair $(i,j)$ with $p_i$ divides $p_j-1$.

*$n=p_1^2p_2\cdots p_n$ for some $n \ge 1$ and distinct primes $p_i$, where there are no $(i,j)$ with $p_i$ divides $p_j-1$, and also no $p_i$ divides $p_1+1$.
Are there any further possible $n$?
Contrary to what I wrote earlier, it is possible to have precisely three groups of order $n$. The values of $n$ with this property and  $n \le 2000$ are:
 75, 363, 609, 867, 1183, 1265, 1275, 1491, 1587, 1725, 1805

I'll leave it to someone else to describe the complete set of such $n$.
A: Take a look at this wikipedia page on $p$-groups: http://en.wikipedia.org/wiki/P-group
The results in the subsection Among groups under the section Prevalence are astonishing.
The basic corollary is: Your question is very hard in general. 
A: The numbers for which there are precisely $1$, $2$ and $3$ groups are classified in the short paper http://www.math.ku.dk/~olsson/manus/three-group-numbers.pdf By Jørn Børling Olsson.
A: Exactly 2 groups. There is a paper, which claims to classify "Orders for which there exist exactly two groups".
This link contains the text of the paper in text (!) format. I didn't find a pdf.
Disclamer: I didn't check if the proofs in the paper are correct. I also don't know, if the paper was published in any peer-reviewed journal (probably it wasn't).
Exactly 3 groups. Proposition 2 of the paper above says, that if $n$ is not cube-free, then there are at least 5 groups of the order $n$. So you are only interested in cube-free numbers. Then you at least know all numbers $n$ with exactly 3 groups for $n<50000$ from here. Based on this one will know the probable answer and then one can try to prove it.
