0

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!

1 Answers1

1

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

user44197
  • 9,730
  • But that procedure is not computationally effective in general since computing discrete logs is notoriously difficult. Perhaps the OPs problem has further structure that makes it easier. – Bill Dubuque Dec 25 '13 at 20:37
  • I agree! In one of my comments I said that the difficulty of computing discrete logarithms is the basis of many cryptographic system. However, he wanted a specific procedure and I don't know any general procedure than what I wrote. – user44197 Dec 25 '13 at 20:41