Solution (source code)

= Solution

Let $|G|=pq$ with primes $p>q$ and $G$ nonabelian. The <Sylow theorems> give $n_p\mid q$ and $n_p\equiv1\pmod p$, so $n_p=1$ and the Sylow $p$-subgroup $P$ is normal. Also $n_q\mid p$ and $n_q\equiv1\pmod q$. If $n_q=1$, both Sylow subgroups are normal and $G$ is their abelian direct product, a contradiction. Hence $n_q=p$, and
$$
\boxed{q\mid p-1.}
$$

Because $G/P$ is abelian, the <commutator subgroup> $G'$ lies in $P$. It is nontrivial because $G$ is nonabelian, and $|P|=p$ is prime, so $G'=P$. Therefore
$$
|G/G'|=q,
$$
and $G$ has exactly $q$ <linear characters>.

Every nonlinear irreducible degree divides $pq$. Its square is at most $pq$, so the only possibility is degree $q$. If there are $b$ such characters, the <sum of squares of irreducible degrees> gives
$$
pq=q+bq^2,
\qquad
b=\frac{p-1}{q}.
$$
The number of irreducible characters equals the number of conjugacy classes, so
$$
\boxed{k(G)=q+\frac{p-1}{q}.}
$$
These are the <irreducible characters of a nonabelian group of order p q>.