Power roots in a finite field (source code)

= Power roots in a finite field

In a finite field with $q$ elements, the equation $x^k=1$ has exactly $\gcd(k,q-1)$ solutions. Indeed, after choosing a generator $g$ of the multiplicative group, $x=g^j$ is a solution exactly when $(q-1)\mid kj$.