Solution (source code)

= Solution

The relation $mR=R^{-1}m$ moves every reflection factor to the right of every rotation factor. Canceling pairs $m^2=I$ and reducing rotation powers modulo $n$ shows that every word has one of the forms
$$
\boxed{D_n=\{R^j:0\leq j<n\}\ \cup\ \{R^jm:0\leq j<n\}.}
$$
Within either family the elements are distinct, since equality would imply equality of two powers of $R$, which has order $n$. No rotation equals a reflection: in the polygon action, rotations preserve planar orientation and reflections reverse it. Thus this complete list has exactly $2n$ elements.

Geometrically, $R$ rotates the polygon by $2\pi/n$ about its centre, and $m$ reflects it in a symmetry axis through the centre. The elements $R^j$ are all rotations; $R^jm$ are all reflections. We use the paper's convention that $D_n$ has order $2n$, since another common convention calls this same group $D_{2n}$.