Prove that if $(ab)^i = a^ib^i \forall a,b\in G$ for three consecutive integers $i$ then G is abelian
A very similar solution, but maybe slightly shorter: again let $i$, $i+1$ and $i+2$ be the three consecutive integers that work for $a$ and $b$. From $a^{i+1} b^{i+1} = (ab)^{i+1} = (ab)(ab)^i = aba^i b^i$ we get $a^i b = b a^i$. The same proof with $i$ replaced by $i+1$ gives $a^{i+1} b = b a^{i+1}$. Now $a b = a b a^i a^{-i} = a a^i b a^{-i} = a^{i+1} b a^{-i} = b a^{i+1} a^{-i} = b a$.
I was writing this as a comment, but it's going to be extensive; I suspect most of the commenters might be interested, so here goes as a community wiki.
A group $G$ is said to be $n$-abelian if $(ab)^n = a^nb^n$ for every $a,b\in G$.
Alperin proved (The classification of $n$-abelian groups, Canad. J. Math. 21 (1969) 1238-1244, MR0248204 (40 #1458)) that the variety of $n$-abelian groups is the join of the variety of abelian groups, the variety of groups of exponent $n$, and the variety of groups of exponent dividing $n-1$ (so a group is $n$-abelian if and only if it is a quotient of a subgroup of a direct product of groups that are either abelian, of exponent $n$, or of exponent dividing $n-1$).
More recently, Primož Moravec (Schur multipliers and power endomorphisms of groups. J. Algebra 308 (2007), no. 1, 12–25. MR2290906 (2007j:20047)) proved that a finite $p$-group is $n$-abelian if and only if $n\in p^{e+r}\mathbb{Z}\cup(1+p^{e+r})\mathbb{Z}$, where $p^e$ is the exponent of $G/Z(G)$ and $r$ is an integer that can be computed, called the "exponential rank of $G$".
A closely related class of groups are the $n$-Bell and the $n$-Levi groups. A group is $n$-Bell if and only if $[x^n,y]=[x,y^n]$ for all $x,y\in G$, where $[a,b]$ is the commutator of $a$ and $b$. A group is $n$-Levi if $[x^n,y] = [x,y]^n$ for all $x,y\in G$. (Note that since $[a,b]=[b,a]^{-1}$, $n$-Levi implies $n$-Bell). A result I noted in passing some years ago was that if a group is $i$-, $i+1$-, and $i+2$-Levi for some integer $i$, then it is $n$-Levi for all $n$ (and hence nilpotent of class at most $2$), very similar to the problem at hand here. Also, $2$-Levi and $(-1)$-Levi imply $n$-Levi for all $n$, just like $(-1)$-abelian and $2$-abelian imply abelian (i.e., $n$-abelian for all $n$).
A nice paper on this subject is L-C Kappe's On $n$-Levi groups. Arch. Math. (Basel) 47 (1986), no. 3, 198–210, MR 0861866 (88a:20048). For a group $G$, let $$\begin{align*} \mathcal{E}(G) &= \{n\mid (xy)^n = x^ny^n\text{ for all }x,y\in G\}\\ \mathcal{L}(G) &= \{n\mid [x^n,y]=[x,y]^n\text{ for all }x,y\in G\}\\ \mathcal{B}(G) &= \{n\mid [x^n,y] = [x,y^n]\text{ for all }x,y\in G\}, \end{align*}$$ called, respectively, the "exponent semigroup", the "Levi semigroup", and the "Bell semigroup" of $G$ (the sets are closed under multiplication, so they are multiplicative semigroups of the integers). Kappe proves that if $W$ is a set of integers, then the following are equivalent:
- $W=\mathcal{E}(G)$ for some group $G$.
- $W=\mathcal{B}(H)$ for some group $H$.
- $W=\mathcal{L}(K)$ for some group $K$.
She also gives conditions for a set of integers to be an exponent semigroup, reminding readers that F.W. Levi proved, in Notes on Group Theory VII. The idempotent residue classes and the mappings $\{m\}$. J. Indian Math. Soc. (N.S.) 9 (1945), 37-42, that if $M$ is the smallest positive integer in $\mathcal{E}(G)$ for which $G^M$ is abelian, then there exist pairwise relatively prime integers $q_i$, $M=q_1\cdots q_t$, $2\lt q_i$, such that $\mathcal{E}(G)$ consists precisely of the integers that are congruent to either $0$ or $1$ modulo $q_i$ for $i=1,\ldots,t$; and that if $q_1,\ldots,q_t$ are pairwise relatively prime integers, $2\lt q_i$ for each $i$, and $S$ is the set of all integers that are congruent to either $0$ or $1$ modulo $q_i$ for each $i$, then there exists a group $G$ such that $\mathcal{E}(G)=S$.
Preliminary comment: There is ambiguity in the statement of the problem, an ambiguity that I am told traces back to the original. I interpret the problem to mean that there exist consecutive integers $i$ such that $(ab)^i=a^ib^i$ for all $a$ and $b$. But the informal language of the problem permits the weaker interpretation that for every $a$ and $b$, there exist three consecutive integers $i$ such that $(ab)^i=a^ib^i$.
I will prove the result under the stronger "uniform $i$" condition. The arguments of the OP and of Robert Israel, proved under weaker assumptions, are therefore clearly "better." The reason for the argument below is that my parsing of the wording interprets the condition as uniform. And the stronger assumption permits a more structured, symmetric approach.
Let our exponents be $n$, $n+1$, and $n+2$.
Note that by associativity, $$(ab)^{n+1}=a(ba)^nb.$$ Thus $$a^{n+1}b^{n+1}=(ab)^{n+1}=a(ba)^{n}b=ab^{n}a^{n}b.$$ Cancellation now gives $$a^nb^n=b^na^n$$ from which we conclude that $$(ab)^n=(ba)^n.$$
A similar calculation with $n+1$ and $n+2$ yields $$(ab)^{n+1}=(ba)^{n+1}$$ and now division gives the desired result.