Monday, January 11, 2016

elementary number theory - Solving axequivcpmodb efficiently when a,b are not coprime



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?



axcmodb




For example, given



154x14mod182, 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?



12260x24560mod24755.



107 needs to be one of the computed answers.


Answer



Below we compute  x2456012260(mod24755)  per your edit, by the method in my first answer.



mod 24755: 0247552456012260390235428040535500



    i.e.    mod24755:     [[1]] 24755x 0 [[2]] 12260x 24560195[[1]]2[[2]][[3]]     235x 390 [[2]]52[[3]][[4]]      40x 4280 [[3]]6[[4]][[5]]     5x535 [[4]]+8[[5]][[6]]        0x 0 



Therefore   x5355(mod24755)107(mod4951),  via canceling  5107+4951k(mod24755),  0k4{107,5058,10009,14960,19911}(mod24755)


No comments:

Post a Comment

analysis - Injection, making bijection

I have injection f:AB and I want to get bijection. Can I just resting codomain to f(A)? I know that every function i...