rtheman's blog

By rtheman, 9 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?
»
9 years ago, # |
  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.

  • »
    »
    9 years ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    Thanks, can you please share a useful link? :)

  • »
    »
    9 years ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    Got it, it is a Diophantine equation, Thanks again :)

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

I bet it is for yesterday's contest ;)