I know how to compute modular multiplicative inverses for co-prime variables a and b, but is there an efficient method for computing variable x where x<b and a and b are not co-prime, given variables a, b and c, as described by the equation below?
ax≡cmodb
For example, given
154x≡14mod182, is there an efficient method for computing all the possibilities of x, without pure bruteforce?
Please note that I'm not necessarily asking for a direct solution, just a more optimized one.
I do not believe that the Extended Euclidean Algorithm will work here, because a and b are not co-prime.
Edit:
Follow up question, since the first one had a shortcut:
Could the be computed efficiently as well?
12260x≡24560mod24755.
107 needs to be one of the computed answers.
Answer
Below we compute x≡2456012260(mod24755) per your edit, by the method in my first answer.
mod 24755: 024755⌢≡2456012260⌢≡390235⌢≡428040⌢≡−535−5⌢≡00
i.e. mod
\begin{align}{\rm Therefore}\ \ \ x\equiv {\color{#c00}{\dfrac{535}5}\!\!\!\pmod{24755}}&\equiv \,107\!\!\pmod{\!4951},\ \ {\rm via\ canceling}\ \ 5\\ &\equiv\, 107+4951k\!\!\pmod{\!24755},\ \ 0\le k\le 4\\[0.5em] &\equiv \{107,\, 5058,\, 10009,\, 14960,\, 19911\}\!\pmod{\!24755}\end{align}
No comments:
Post a Comment