Roots of unity in a finite field (source code)

= Roots of unity in a finite field

The multiplicative group $\mathbb F_q^\times$ is cyclic of order $q-1$, so it contains all $m$th roots of unity when $m$ divides $q-1$ and the characteristic does not divide $m$.