Solution (source code)

= Solution

The <conjugacy classes> are $\{1\}$, $\{a^n\}$, $\{a^r,a^{-r}\}$ for $1\leq r\leq n-1$, and two classes containing respectively $ba^{2s}$ and $ba^{2s+1}$, each of size $n$. Conjugation by $b$ inverts powers of $a$, while conjugation by $a$ changes the exponent of $ba^r$ by two; these facts prove the list and sizes. The sizes total $4n$.

The complete <character table> is specified by the following array, with one column for every $r$ and one row for every $j$ in the indicated ranges:
$$
\boxed{\begin{array}{c|ccccc}
\text{class}&1&a^n&\{a^r,a^{-r}\}&\{ba^{2s}\}&\{ba^{2s+1}\}\\
\text{size}&1&1&2&n&n\\\hline
\chi_{\alpha,\beta}&1&\alpha^n&\alpha^r&\beta&\alpha\beta\\
\chi_j&2&2(-1)^j&2\cos(\pi jr/n)&0&0
\end{array}}
$$
Here $1\leq r,j\leq n-1$; the four pairs $(\alpha,\beta)$ are those in part (ii). In particular, this formula displays both parity cases without concealing the different values $\pm i$ when $n$ is odd. The zero entries follow because the two-dimensional <matrices> representing $ba^r$ are off-diagonal.