TITLE: If I know the order of every element in a group, do I know the group?
QUESTION [68 upvotes]: Suppose $G$ is a finite group and I know for every $k \leq |G|$ that exactly $n_k$ elements in $G$ have order $k$. Do I know what the group is? Is there a counterexample where two groups $G$ and $H$ have the same number of elements for each order, but $G$ is not isomorphic to $H$? I suspect that there is, but I haven't thought of one.

REPLY [75 votes]: Take $G=\mathbb{Z}/4\times \mathbb{Z}/4$, and $H=Q_8\times \mathbb{Z}/2$ of order $16$, where $Q_8$ denotes the quaternion group. Both groups have exactly $1$ element of order $1$, $3$ elements of order $2$ and $12$ elements of order $4$.
Edit: I understood the question as follows: Is there a counterexample where two groups $G$ and $H$ have the same number of elements for each order, but $G$ is not isomorphic to $H$ ? Is it really required, that all elements different from $1$ in $G$ have the same order ?