-1

The specific question is$\ 29x \equiv 3 \pmod {1087}$. How can I go about this without going through 1087 cases?

S.C.B.
  • 22,768
bendl
  • 132

2 Answers2

0

The typical method to solve a problem such as this is by somehow finding the multiplicative inverse of $29$, then multiplying both sides of the equivalence. One of the more popular methods is the extended Euclidean algorithm. I've often used Fermat's Little Theorem or Euler's Theorem to calculate inverses for Project Euler problems. A computer can perform the exponentiations quickly, though I wouldn't want to do it by hand.

For this particular problem, I'll propose a completely different method of solving it. According to my calculator program, $1087\equiv14\pmod{29}$. Then $2(1087)\equiv-1\pmod{29}$. So $3+6(1087)$ should be a multiple of $29$. Add $6(1087)$ to the right side of the original equivalence and simply divide both sides by $29$ to get $x\equiv225\pmod{1087}$.

Mike
  • 13,318
  • You are essentially using the associated Bezout equation - see the first method in my answer for this method presented in fractional form. – Bill Dubuque Feb 15 '17 at 19:25
0

${\rm mod}\ 29\!:\ 3 = 29x\!+\!1087y \equiv 14y\!\iff\! y \equiv \dfrac{3}{14} \equiv \dfrac{6}{28} \equiv \dfrac{6}{-1}\equiv -6\iff \color{#c00}{y= -6\!+\!29n}$

Therefore $\ x = \dfrac{3-1087\color{#c00}y}{29} = \dfrac{3-1087(\color{#c00}{-6\!+\!29n})}{29} =\, 225-1087n$


Or, compute $\, x\equiv 3/29\equiv 225 \pmod{\!1087}\,$ by the fractional extended Euclidean algorithm

${\rm mod}\,\ 1087\!:\,\ {\dfrac{0}{1087}\overset{\large\frown}\equiv\dfrac{3}{29}\overset{\large\frown}\equiv\dfrac{-111}{14}}\overset{\large\frown}\equiv\dfrac{225}1\,$ or, equivalently, without fractions

$\begin{array}{rrl} [1]:&\!\! 1078\,x &\!\!\!\!\equiv\ 0\,\\ [2]:& 29\,x &\!\!\!\!\equiv\ 3\\ [1]-37\,[2]=:[3]:& 14\,x &\!\!\!\!\equiv -111\\ [2]\ -\ 2\ [3] =: [4]:& x &\!\!\!\!\equiv 225 \end{array}$

Above we are performing the Euclidean algorithm on the coef's of $x,\,$ reducing them till we reach $\,\gcd(1078,29) = 1.\ $ But we perform the operation on the entire equation (row) e..g $\,1078\! -\! 37(29)=14\,$ becomes $\,[1]-37[2] =: [3]\,$ when extended to the whole equation (row).

Bill Dubuque
  • 272,048