TITLE: A condition for a finite group to be abelian
QUESTION [8 upvotes]: I know that a group of order $pq$ where $p < q$ and $p \not\mid q-1$ is abelian (in particular it is cyclic), and that a group of order $p^2q^2$ where $p$ and $q$ are distinct primes, $q \not\mid p^2-1$, and $p \not\mid q^2-1$ is abelian.  I have attempted to generalize this (in what seems like the obvious way) and would appreciate it if someone could confirm the validity (or lack thereof) of my "conjecture".  
Let $G$ be a group with $|G|=p^nq^m$ where $p$, $q$ are distinct primes and $n, m \ge 1$.  Furthermore, assume that $p \not\mid q^k-1$ and $q \not\mid p^k-1$ for $1 \le k \le m$ and $1 \le k \le n$, respectively.  Then $G$ is abelian.
Proof: Every divisor of $|G|$ is of the form $p^sq^t$ with $0 \le s \le n$ and $0 \le t \le m$.  If $s \ne 0$ then $p\mid p^sq^t$ so that $p^sq^t \equiv 0 \,\,\mbox{mod}\,p$, and similarly if $t \ne 0$ then $p^sq^t \equiv 0 \,\,\mbox{mod}\,q$.  Therefore we will now assume that $s=0$ or $t=0$.  Let $1 \le k \le n$.  If $p \not\mid q^k-1$ for all $k$, then $q^k \not\equiv 1 \,\, \mbox{mod}\,p$ and if $q \not\mid p^k-1$ for all $k$ then $p^k \not\equiv 1\, \mbox{mod} \,q$.  Therefore $1$ is the only divisor of $|G|$ that is congruent to $1 \,\mbox{mod}\,p$ and $1 \, \mbox{mod}\,q$.
It follows by Sylow's Third Theorem that $G$ has only one Sylow $p$-subgroup and one Sylow $q$-subgroup.  In addition, each of these subgroups is normal.  Clearly the order of their product is $|G|$ and they intersect trivially.  Furthermore, it can be shown (see proof of Theorem 24.6 in Contemporary Abstract Algebra, Gallian, 5th ed.) that all elements in these subgroups commute.  Therefore, $G$ is abelian.

REPLY [2 votes]: This isn't true. $G = H_5 \times H_7$, where $H_p$ is the Heisenberg group mod $p$, is a counterexample. See Keith Conrad's notes here.
I don't know what Theorem 24.6 of Gallian's book states, but groups of order $p^k$ are not guaranteed to be abelian unless $k \leq 2$.