To solve Bx≡A(modm), use Gauss' algorithm.
The algorithm works perfectly when A<B. For example, to solve 6x≡5(mod11): x≡56≡5(2)6(2)≡1012≡101
so x≡10
But when A>B, I run into problems. For example, trying to solve 7x≡13(mod100): x≡137≡13(15)7(15)≡195105≡955≡95(21)5(21)≡1995105≡955 and it continues to be 955. Am I missing a step?
PS: I was applying the algorithm on random linear congruence problems I could find. The second example comes from http://www.johndcook.com/blog/2008/12/10/solving-linear-congruences/, which says the answer is x≡59.
update
This answer answered my question. It explains that Gauss' algorithm works only on prime modulo.
Answer
This answer answered my question. It explains that Gauss' algorithm works only on prime modulo.
No comments:
Post a Comment