1
$\begingroup$

Let's say I have three known numbers : $a$, $b$ and $m$.

I want to find the smallest $x$ so that $a.x \equiv b\ (mod\ m)$ (the product of $a$ and $b$ is congruent to $b$ modulo $m$).

In the cases where such an $x$ exists, is there a simple equation that allows me to get the value for $x$ ?

Note: the numbers $a$, $b$ and $m$ can be very large numbers. I am looking for a direct resolution of the equation, not a solution involving iterating through all possible values of $x$ or modular-rewriting of $a$ and $b$.

  • 2
    There is no simple equation, but there is a simple and efficient algorithm, Euclid's. You'll probably find it explained in several earlier questions on this site.2012-08-24

0 Answers 0