1

$a=19845$, $b=218$

I got this far but am now stuck and don't know what to do.

19845 % 218 = 7
218 % 7 = 1
1 = 218 - (7*31)
7 = 19845 - (218*91)
1 = 218 - ((19845-218*91)*31)

Then from there I do not know how to simplify it to get the values for $s$ and $t$.

Librecoin
  • 2,740

3 Answers3

3

Use the distributive law: \begin{align} 1 &= 218 - (19845-218\cdot 91)\cdot 31 \\ &= 218 - 19845\cdot 31 + 218\cdot 91\cdot 31 \\ &= 218 \cdot (1 + 91\cdot 31) + 19845\cdot (-31) \\ &= 218\cdot 2822 + 19845\cdot (-31) \end{align} Thus, $s=-31$ and $t=2822$.

Christoph
  • 24,912
2

Alternatively, you can use the Euclid-Wallis Algorithm: $$ \begin{array}{r} &&91&31&7\\\hline 1&0&1&-31&218\\ 0&1&-91&2822&-19845\\ 19845&218&7&1&0\\ \end{array} $$ This says that $$ 2822\cdot218-31\cdot19845=1 $$ The bookkeeping incorporated in that algorithm takes care of the difficulty that often accompanies the Euclidean Algorithm.

robjohn
  • 345,667
0

$ 218t+19845s = 1\iff \bmod 218\!:\ s\equiv\dfrac{1}{19845}\equiv \dfrac{1}7\equiv \dfrac{-217}7\equiv -31$

Bill Dubuque
  • 272,048