If we have the Bezout coefficient, how to find the smallest possible coefficient that can take its place?

35 Views Asked by At

The question is the following:

"Determine the pair of numbers m,n such that gcd(1234,5678)=1234⋅m+5678⋅n for which n is the smallest positive integer".

I found that m=704 and n=-153. But n is negative here, so that can't be an answer. I assumed I could take 154 (since it's a multiple of 2) and add it to -153, which would give 1 and 1 is in ℤ2. However the pair (m,n)=(1,704) doesn't make much sense to me.

Why was my solution wrong and what is the right way to solve this problem?