# Finding all numbers smaller than $2040$ so that $51 | 71n-24$ [duplicate]

This is a Number Theory problem about the extended Euclidean Algorithm I found:

Use the extended Euclidean Algorithm to find all numbers smaller than $$2040$$ so that $$51 | 71n-24$$.

As the eEA always involves two variables so that $$ax+by=gcd(a,b)$$, I am not entirely sure how it is applicable in any way to this problem. Can someone point me to a general solution to this kind of problem by using the extended Euclidean Algorithm? Also, is there maybe any other more efficient way to solve this than using the eEA?

(Warning: I'm afraid I'm fundamentally not getting something about the eEA, because that section of the worksheet features a number of similiar one variable problems, which I am not able to solve at all.)

I was thinking about using $$71n-24=51x$$, rearranging that into $$71n-51x=24.$$ It now looks more like the eEA with $$an+bx=gcd(a,b)$$, but $$24$$ isn‘t the $$gcd$$ of $$71$$ and $$51$$...

• " but 24 isn‘t the gcd of 71 and 51..." No, but $24$ is a multiple of the gcd.....Find $71n-51x =1$ and then $71(24n) -51(24x)= 24$ and $71(24n-51k) - 51(24n+71k) = 24$ and $71(24n-51k) -24$ will be divisible by $51$. ALthough I must confess that's not really how I'd want to do it. Not as $3|24$ and $51$ then $3$ will divide your $N = 24n-51k=3(8n -17k)$ – fleablood Apr 23 at 0:04
• See the last dupe for the backward (and simpler forward) version of the extended Euclidean algorithm, and see the others for the theory and various other methods of computing modular inverses and fractions. We have hundreds of posts on this topic. Please search before posing questions. – Bill Dubuque Apr 23 at 0:10

You are looking for numbers such that $$71n\equiv24\bmod51$$.

The extended Euclidean algorithm gives the Bezout relation $$23\times71-32\times51=1$$,

so $$23\times71\equiv1\bmod51$$. Therefore, you are looking for $$n\equiv23\times24\bmod51$$.

Alternatively, you could say $$20n\equiv24\bmod51$$, so $$5n\equiv6\bmod 51$$,

and $$5\times10=50\equiv-1\bmod51$$, so $$n\equiv6(-10)=-60\bmod51$$.

• Please strive not to add more dupe answers to dupes of FAQs. – Bill Dubuque Apr 22 at 23:57

This is asking you to find solutions to $$71n-24\equiv 0 \bmod 51$$, which equivalently is $$20n\equiv 24\bmod 51$$.

To do this you can proceed by finding the modular multiplicative inverse of $$20 \bmod 51$$ using the extended Euclidean algorithm , as you say.

So:
$$\begin {array}{rrc} a&b&51a+20b\\ \hline 1 & 0 & 51\\ 0 & 1 & 20\\ 1 & -2 & 11\\ -1 & 3 & 9\\ 2 & -5 & 2\\ -9 & 23 & 1 \\ \end{array}$$

So the last line says: $$-9\cdot 51 + 23\cdot 20 = 1$$ (check this if nervous), so $$23\cdot 20 \equiv 1\bmod 51$$ and $$23$$ is the inverse of $$20\bmod 51$$.

So then $$23\cdot 20n\equiv 23\cdot 24\bmod 51$$ giving $$n\equiv 42\bmod 51$$ and we have solutions $$n\in\{42,93,144,\ldots\}$$ up to the upper limit given.

• Please strive not to add more dupe answers to dupes of FAQs. – Bill Dubuque Apr 22 at 23:57

Other way

$$71n\equiv 24\pmod {51}\iff$$ $$20n\equiv 24\pmod {51}\iff$$ $$5n\equiv 6\pmod {51}\iff$$ $$5n\equiv -45\pmod {51}\iff$$ $$n\equiv -9 \pmod {51}$$

• Please strive not to add more dupe answers to dupes of FAQs. – Bill Dubuque Apr 22 at 23:57