A problem about powers of a group. We know any group of order $p^2$ is abelian. Does there exist fixed powers $k$ such as $2$ for which a group having order $p^k$ will be abelian? Or does there exists primes $p$ for which a group having order any power of $p$ will be abelian?
 A: For all $n>2$ there exists a non-abelian group of order $p^n$. This is because there are non-abelian groups of order $p^3$, so simply take such a group $H$ and form the direct product with the cyclic group of order $p^{n-3}$, $G=H\times \mathbb{Z}/p^{n-3}\mathbb{Z}$. Then $G$ is non-abelian of order $p
^n$.
So, there are non-abelian groups of order $p^3$? In fact, there are always 5 groups of order $p^3$: 3 abelian, 2 non-abelian. The 3 abelian groups are clear. The 2 non-abelian groups are the Heisenberg group
$$
\left\{\left(
\begin{array}{ccc}
1&a&b\\
0&1&c\\
0&0&1
\end{array}\right)
\mid
a, b, c\in\mathbb{Z}/p\mathbb{Z}
\right\}
$$
while the second is the following group:
$$
\left\{\left(\begin{array}{cc}
1+(p)&b\\
0&1\end{array}\right)\mid(p)=p\mathbb{Z}/p^2\mathbb{Z} \text{ and }b\in\mathbb{Z}/p^2\mathbb{Z}\right\}.
$$
For example, if $p=2$ these are $D_4$ and $Q_8$. For a reference, these notes of Keith Conrad are self-contained. They use semi-direct products.
A: To answer both of your questions, there exists a nonabelian group $G$ of order $p^3$ for any prime $p$. For example, let $\mathbb{Z}_p$ act on $V = \mathbb{F}_p^2$ by $\pmatrix{1 & 1 \\ 0 & 1}$. Then the semidirect product $\mathbb{Z}_p\ltimes V$ is nonabelian, since the action is nontrivial (and the groups involved are abelian).
