rtheman's blog

By rtheman, 11 years ago, In English

How to solve for(M,N) it the equation of the form M*c1+c2=N*c3+c4, using Extended euclidean algo. Here c1,c2,c3,c4 are known constants.

  • Vote: I like it
  • 0
  • Vote: I do not like it

| Write comment?
»
11 years ago, hide # |
 
Vote: I like it +1 Vote: I do not like it

Convert to c1M + c3( - N) = c4 - c2. This is now in the form ax + by = c, solving for x, y, which can be done using Extended Euclidean algorithm.

»
11 years ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

I bet it is for yesterday's contest ;)