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

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

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

So the number of distinct bracelets is \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?