Ideals in $\mathbb{Z}$. From Pinter's Book of Abstract Algebra From Pinter 22.G.6
Let $G$ be a group,  $a, b \in G$.
Let $S = \{n \in \mathbb{Z} : ab^n = b^na\}$
Prove that $S$ is an ideal of $\mathbb{Z}$.
For an abelian group, $S = \mathbb{Z}$.  For a non-abelian group, $S$ will contain all the multiples of the group order.  But I don't know how to determine if there would (or wouldn't) be other values.
 A: First of all, we see that 
$ab^0 = a = b^0a = a, \tag 1$
so $0 \in S$, always, for any $a, b \in G$; $S \ne \emptyset$, ever, and if $S = \{0\}$, we are done.  Next, we observe that if $n \in S$, $-n \in S$ also, since
$ab^n = b^na \Longleftrightarrow b^{-n}ab^n = a \Longleftrightarrow b^{-n}a = ab^{-n}; \tag2$
thus if $S \ne \{0\}$, it contains a positive integer $m$; as such, $S$ contains a least positive element $p$;  now for any $t \in S$, we may by the division algorithm write
$t = pq + r, \tag 3$
with either $r = 0$ or $1 \le r < p$; since $t \in S$,
$b^t a = ab^t, \tag 4$
or
$b^{pq + r} a = ab^{pq +r}; \tag 5$
we have:
$b^{p(q - 1)+ r} b^p a = b^{pq + r} a =  ab^{pq + r}, \tag 6$
but since
$b^p a = ab^p, \tag 7$
(6) yields
$b^{p(q - 1)+ r} a b^p =  ab^{pq + r}, \tag 8$
or
$b^{p(q - 1) + r} a = a b^{(q - 1) + r}; \tag 9$
we can continue in this manner until we reach
$b^r a = a b^r; \tag{10}$
but this contradicts the minimality of $p$ unless $r = 0$; thus $t = pq$ is a multiple of $p$; it is clear from (7) that every multiple of $p$ is in $S$; so
$S = (p), \tag{11}$
the principal ideal in $\Bbb Z$ generated by $p$.
