If $f(g) = g^k$ is a homomorphism on a finite group $G$ and $k < |G|$ does not divide $|G|$, must $G$ be abelian? There was a question that asked to prove that if $f(g) = g^3$ is a homomorphism on a finite group $G$ and $3$ does not divide $|G|$, then $G$ is abelian. Does this extend to any $k < |G|$ where $k$ does not divide $|G|$, instead of just the case $k = 3$? I.e. if $f(g) = g^k$ is a homomorphism and $k < |G|$ does not divide $|G|$, is $G$ abelian? If not, what is a counterexample?
 A: No, the Quaternion group $Q$ of order $8$ is non-abelian, but the fifth power map is a homomorphism $Q\to Q$ (the identity).
A: Consider a non-abelian $p$-group of exponent $p$, with $p$ an odd prime. For instance the group of order $p^{3}$ and exponent $p$ will do.
Then
$$
(ab)^{p+1} = (ab)^{p} a b = a b = a^{p} a b^{p} b =  a^{p+1} b^{p+1}.
$$

In general, if $G$ is any finite group of exponent $e < \lvert G \rvert$, then $k = e+1$ should do. See for instance the example by James.
A: We have $(xyx^{-1})^3 = x^3y^3x^{-3}$ by that homomorphism. By writing out the product we get $xy^3x^{-1} = x^3y^3x^{-3}$. Therefore, $y^3x^2 = x^2y^3$. Since the $3$ does the divide the order of $|G|$, every element in $G$ is a cube. Therefore, the squares commute with $G$. Now write $(ab)^3 = a^3b^3$, expand, and commute the squares, and you get $ab=ba$. 
Now if we try to do is more generally, if $k$ does not divide $|G|$, then the claim that every element of $G$ is a $k$-th power does not generalize. Unless we know that $k$ is a prime. But even if $k$ is a prime and does not divide $|G|$, then I am not sure how to conclude that it is abelian. For example, if $k=5$, then we reach $(b^3a^3) = (ab)^3$, and not sure if this is enough anymore. 
