For every even $n>4$ there exists nonabelian group. As example of such group we can take dihedral group.


The question is about odd $n$. For some of them there are no nonabelian groups of order $n$ (for example, if $n$ is prime then the group of order $n$ is cyclic and hence abelian).


For what odd $n$ are there known examples of nonabelian finite groups of order $n$?



Finite nonabelian groups of odd order
It's well-known that for a natural number $n$ with prime factorization
$n=\prod\_i p\_i^{r\_i}$, all groups of order $n$ are abelian if and only if
all $r\_i\le 2$ and
$\gcd(n,\Phi(n))=1$ where $\Phi(n)=\prod\_i (p\_i^{r\_i}-1)$.
(See <http://groups.google.co.uk/group/sci.math/msg/215efc43ebb659c5?hl=en>)


For other $n$ there are non-abelian groups. If some $r\_i\ge3$
then we can take a direct product of a non-abelian group of order $p\_i^3$ and
a cyclic group. There are always non-abelian groups of order $p^3$;
when $p=2$ take the quaternion group, and when $p$ is odd the group
of upper triangular matrices with unit diagonal over $\mathbb{F}\_p$.


Otherwise $G$ will have a factor $pq$ with $p\mid(q-1)$ or $pq^2$ with
$p\mid(q^2-1)$. In the first case the group of all maps $x\mapsto ax+b$
for $a$, $b$, $x\in\mathbb{F}\_q$ and $a\ne 0$ has a non-abelian subgroup
of order $pq$. In the second case replace $\mathbb{F}\_q$
by $\mathbb{F}\_{q^2}$ and then get a non-abelian group of order $pq^2$.
In both cases multiply by a cyclic group to get an order $n$ non-abelian group.


