In a group, when does $|ab| = \mathrm{lcm}(|a|, |b|)$ In a finite abelian group $G$ where $a$ has order $m$ and $b$ has order $n$, I was able to prove that $\mathrm{lcm}(m,n) \mid |ab|$ by proving that $(ab)^{\mathrm{lcm}(m,n)} = e$. I know that it is not true in general that $|ab| \mid \mathrm{lcm}(m,n)$, but I'm trying to motivate a counterexample.
My thought was that the following formula relating the lcm and gcd is useful:
$$
\mathrm{lcm}(m,n) = \frac{mn}{\mathrm{gcd}(m,n)}.
$$
If $m$ and $n$ are relatively prime, then $\mathrm{lcm}(m,n) = mn$. That doesn't tell me anything necessarily about the order of $ab$, however, unless it is true in general that if $\gcd(a,b) = 1$, then $|ab| = |a||b|$. In that case, we have $\mathrm{lcm}(m,n) = |ab| = mn$ if and only if $m$ and $n$ are relatively prime, and I should look for a counterexample where two elements have relatively prime order.
I'd appreciate if someone could comment a bit more on this. I'm especially interested in how to motivate counterexamples. Though I'm able to follow those I read, I have trouble coming up with them on my own.
 A: I know I've written some of this before, but I cannot locate it right now; perhaps someone with better se-search-foo than I can find them...
Here are some results; throughout $G$ is a group, $a$ and $b$ are elements of finite order that commute, and $o(x)$ denotes the order of the element $x$.
Lemma 1. Let $G$ be a group, $p$ a prime, let $a,b\in G$ be commuting elements of finite order, and let $o(a)=p^r$, $o(b)=p^s$, with  $r\leq s$. If $o(ab)\lt p^s$, then $r=s$.
Proof. If $o(ab)=p^t$ with $t\lt s$, then $a^{p^t}b^{p^t}=e$, and so $e\neq b^{p^t}=a^{-p^t}$. Now, $b^{p^t}$ has order $p^{s-t}\gt 1$, and $a^{-p^t}$ has order $p^{\max(0,r-t)}$. But since $0\lt s-t$, it follows that $r-t=s-t$, and hence that $r=s$, as claimed. $\Box$
Lemma 2. Let $p$ be a prime, and let $n\gt 0$. For every $r$, $0\leq r\leq n$, there exists a group $G$ and commuting elements $a$ and $b$ in $G$ such that $o(a)=o(b)=p^n$, and $o(ab)=p^r$.
Proof. Let $C_k(x)$ denote the multiplicative cyclic group of order $k$ generated by $x$. Fix $r$ and $n$, $0\leq r\leq n$, and let $G=C_{p^r}(x)\times C_{p_n}(y)$. Let $a=(x,y^{-1})$ and $b=(e,y)$. Then $o(a)=o(b)=p^n$, and $ab=(x,e)$ has order $p^r$, as desired. $\Box$
So we want to focus on those primes which occur to the same positive power in $n$ and $m$: those are the only ones that are "in play". To that end, let $d=\gcd(n,m)$, and let $f$ be the largest divisor of $d$ with the property that
$$\gcd(f,n/d) = \gcd(f,m/d) = 1.$$
If $p$ is a prime that divides both $n$ and $m$, then $p$ divides $f$ if and only if the largest power of $p$ that divides $n$ is equal to the largest power of $p$ that divides $m$; that is, the primes that are "in play." Then we have the following result, which appears as Theorem 3 in this paper of Dieter Jungnickel mentioned in the comments (from which I'm borrowing the notation and the definition of $f$, as I was having trouble articulating it and then I looked through the paper to see if he had it succintly, which he does):

Theorem. Let $G$ be a group, and let $a$ and $b$ be commuting elements with $o(a)=n$ and $o(b)=m$. Let $d=\gcd(n,m)$ and $f$ be defined as in the previous paragraph. Then
$$\frac{nm}{df} \,\Bigm|\, o(ab)\,\Bigm|\, \frac{nm}{d}.$$
Moreover, if $k$ is any integer multiple of $\frac{nm}{df}$ that divides $\frac{nm}{d}=\mathrm{lcm}(n,m)$, then there is a group $G$ and commuting elements $a$ and $b$ of orders $n$ and $m$ such that $o(ab)=k$.

Note that this is slightly better than saying the order is a multiple of $\mathrm{lcm}(n,m)/\gcd(n,m)$, since that is equal to $\frac{nm}{d^2}$ and $f$ is a (possibly proper) divisor of $d$.
