0

The question says:

  • Find a and b integers where:

$671a-654b = 18$ and $\gcd(a,b) = 18$

My attempt was:

$a = cd$ where $d$ is $\gcd$ and $c$ is just an integer.

$b = kd$ where $k$ is just an integer too.

$k$ and $c$ are co-prime, btw (This is all according to a law in math, I don't know its name though)

By putting them in the equation we find:

$d(671c - 654k) = 18$

which is

$671c - 654k = 1$

By using the euclidean algorithm, I only found this which is not correct:

$76(671) - 78(654) = -16$

-$16$ should be $1$ in its place but it isn't, so it's not right, either.

So how do I continue from here?

EDIT: I redid my algorithm and I found that $c = 77$ and $k = -79$ which after putting it in a and b, I find their values. Thank you all!

  • Perhaps you could give your Euclidean algorithm workings - likely there is a mistake somewhere there. – Mark Bennet Feb 04 '21 at 18:27
  • 671 and 654 are coprime, I bet, so the numbers you need exist. Try again the euclidien algorithm, but more accurately. – Timur Bakiev Feb 04 '21 at 18:28
  • Scale by $18$ the Bezout equation for $, 671 (a/18) -654 (b/18)=1,$ as in the Theorem in the linked dupe. You can compute the Bezout equation for $\gcd(671,654) = 1$ by the extended Euclidean algorithm. We can't debug your use of this algorithm w/o seeing your work. Often the error is in back-substitution - which the linked forward algorithm avoids. We have hundreds of prior worked examples (see the "Linked" questions on the linked algorithm page). – Bill Dubuque Feb 04 '21 at 18:57

1 Answers1

2

Hint:

Use first the extended Euclidean algorithm to find $u$ and $v$ such that $$671u-654v=1$$ since $671$ and $654$ are coprime, then multiply $u$ and $v$ by $18$ to obtain $a$ and $b$.

Added. The algorithm:

\begin{array}{rrrl} r_k & u_k & v_k & q_k \\ \hline 671 & 1 & 0 \\ 654 & 0 & 1 & 1 \\ \hline 17 & 1 & -1 & 38 \\ 8 & -38 & 39 & 2 \\ 1 & \color{red}{77} & \color{red}{-79} \\ \hline \end{array}

Bernard
  • 175,478
  • Yes. I did that. I found it wrong(Which is written on my post) Can you please give it a try and calculate it for me? I tried it so many times and in so many directions and I still don't find it. – TechnoKnight Feb 04 '21 at 19:01
  • @TechnoKnight: Do you know this layout for the algorithm? – Bernard Feb 04 '21 at 19:16
  • I didn't do it that way, I will add my solution after minutes. Can you look at it and tell me where I went wrong? – TechnoKnight Feb 04 '21 at 19:19
  • I redid it and I found where I went wrong. Thank you for your help! – TechnoKnight Feb 04 '21 at 19:26
  • You should learn to do it the way I did, as it a safe method, easy to check. I just did by hand what implemented algorithms do (using the all intermediate remainders satisfy a Bézout's equation, with coefficients that can be determined by the recurrence relation of order $2$: $u_{k+1} =u_{k-1}-q_ku_k$, and similarly for $v_k$. – Bernard Feb 04 '21 at 19:32
  • Okay so I found the numbers but the problem is that $a$ and $b$ are supposed to be natural which means positive. But only $a$ is positive, $b$ is negative. What do I do now? – TechnoKnight Feb 04 '21 at 19:43
  • Your question has a minus sign, so just take $|b|$. – Bernard Feb 04 '21 at 19:49