I'm trying to derive a formula for the number of distinct bracelets made up of n beads (n prime $\displaystyle \neq 2$), with k possible colors for each bead, if the permitted symmetries consist of rotations and refections.

Rotations:
The identity element fixes $\displaystyle k^n$ colorings and the other $\displaystyle (n-1)$ rotations fix k colorings.

Reflections:
Each reflection about the n beads fixes $\displaystyle k^{\frac{n+1}{2}}$ colorings.

So the number of distinct bracelets is $\displaystyle \frac{1}{2n}(k^n+ (n-1)k + n k^{\frac{n+1}{2}})$

Firstly, is this correct? And secondly, why does this formula not work if m is an odd composite?