Inverting exponentiation modulo a prime

38 Views Asked by At

Suppose $p$ is an odd prime, $g$ is a primitive root of $p$, where $i<p$ is any integer, and $w(i) = g^i \bmod p = k$.

Note that if $i \neq j$, then $w(i) \neq w(j)$, so the map is in principle invertible.

For a given k, is there a general method for finding i? All solutions I've seen have been basically trial and error, with some clever tricks to narrow the search space if i and k happen to be certain values.