A group $G$ is said to be an $n$-abelian group if the $n$th power map is an endomorphism of $G$.
Given a subset $S$ of the integers, three necessary conditions for $S$ to be the set of all integers $n$ for which $G$ is an $n$-abelian group for some fixed group $G$ are the following:
- $1 \in S$
- If $m,n \in S$, then also $mn \in S$.
- If $n \in S$, then also $1-n \in S$ (together with the first condition, this implies that $0 \in S$).
Question: Conversely, is the conjunction of the above three conditions also sufficient for $S$ to be the set of all integers $n$ for which $G$ is an $n$-abelian group for some fixed group $G$?
The idea, of course, is to let $G$ be the quotient of the free group $\langle x,y\rangle$ on two generators by the normal subgroup generated by all elements of the form $(xy)^n y^{-n} x^{-n}$ where $n \in S$.
The problem here is that conceivably, $G$ could be an $n$-abelian group for some $n \notin S$. The question then asks whether this problem will ever happen.
A group $G$ is $n$-abelian if $(ab)^n = a^nb^n$ for all $n$.
The set you are looking at is
$$\mathcal{E}(G) = \{ n\in\mathbb{Z}\mid (ab)^n = a^nb^n\}.$$
That set forms a Levi system. This was studied by L.C. Kappe:
Your conditions are not quite enough. A set of integers is a Levi system if and only if it satisfies the following 5 conditions:
Kappe proves that a set of integers is equal to $\mathcal{E}(G)$ for some $G$ if and only if it is a Levi system or it equals $\{0,1\}$.
See this mathoverflow answer for this and related concepts and references.