Given
$$ a^n \bmod b = x,$$
how can we find $m$ such that
$$a^m \bmod c = x?$$
Edit: Alternatively, since we know $a$, $c$, and $x$, how you can solve for $m$ directly?
Thanks for your help!
Given
$$ a^n \bmod b = x,$$
how can we find $m$ such that
$$a^m \bmod c = x?$$
Edit: Alternatively, since we know $a$, $c$, and $x$, how you can solve for $m$ directly?
Thanks for your help!
Here is a general procedure for solving $$ a^m \equiv x \mod c $$ I will assume that $x$ and $c$ are co-prime and $r$ is primitive root of $c$, i.e $$ r^{\phi(c)} \equiv 1 \mod c ~~\hbox{and} ~~ r^k \not \equiv 1 \mod c, ~1\le k < \phi(c) $$ We can always find an $m$ so that $r^\alpha = x$. $\alpha$ is the discrete logarithm of $x$. Let $a = r^\beta$. Then the original equation becomes
$$ \left(r ^\beta\right)^m=r^\alpha \mod c$$
The solution to this is $$ \beta m = \alpha \mod \phi(c) $$
Hope this helps