Here is a diophantine equation for me and Chris and whoever else is interested to practice on:
Here is the solution - but can we reproduce it with minimal cheating? Maybe Chris can solve it a less conventional way. He is pretty tricky like that. :))
(gcd = greatest common divisor)
1. There is only a solution when gcd( 1027, 712 ) = 1 or in other words 1027 and 712 are relatively prime.
2. Using the Euclidian algorithm to calcutate gcd(1027,712)
abqr10277121315712315282315823698269113691354134314140
The greatest common divisor gcd(1027,712) =1
and we can go on
3. Using Extended Euclidean algorithm to calculate the first solution
abqrxy10277121315−16573−1(−165)=23871231528273−19−2⋅73=−16531582369−1916−3(−19)=73826911316−3−1⋅16=−19691354−31−5(−3)=161343110−3⋅1=−3414000⋅4+1=1
The first solution is (−165,238)1027⋅(−165)+712⋅238=1
4. All Solutions:
a⋅x+b⋅y=1First solution (x0, y0)All solutions (x0+z⋅bgcd(a,b), y0−z⋅agcd(a,b))
1027⋅x+712⋅y=1First solution (x0=−165, y0=238)All solutions (−165+z⋅7121, 238−z⋅10271)
we have:
{ ( −165+712⋅z, 238−1027⋅z) | z∈Z }
I'm going to employ maximum cheating on this one.......
Using the Euclidian algorithm, we have
1027 = 1(712) + 315
712 = 2(315) + 82
315 = 3(82) + 69
82 = 1(69) + 13
69 = 5(13) + 4
13 = 3(4) + 1
4 = 4(1) + 0
1 2 3 1 5 3 4
1 0 1 2 7 9 52 165 712
0 1 1 3 10 13 75 238 1027
Take the determinant of 165 712
238 1027 = -1
So.....
1027(165) - 712(238) = - 1 but...we need a "+1 " .....so......multiplying through by -1, we have
1027(-165) + 712(238) = 1
So....x = -165 and y = 238....however.....this is only one solution.....the general solution is given by
x , y = [ (-165 + 712k), (238 - 1027k) ]
Well....Ms. SmartyPants......I even provided a general solution.....so.....take that !!!
(gcd = greatest common divisor)
1. There is only a solution when gcd( 1027, 712 ) = 1 or in other words 1027 and 712 are relatively prime.
2. Using the Euclidian algorithm to calcutate gcd(1027,712)
abqr10277121315712315282315823698269113691354134314140
The greatest common divisor gcd(1027,712) =1
and we can go on
3. Using Extended Euclidean algorithm to calculate the first solution
abqrxy10277121315−16573−1(−165)=23871231528273−19−2⋅73=−16531582369−1916−3(−19)=73826911316−3−1⋅16=−19691354−31−5(−3)=161343110−3⋅1=−3414000⋅4+1=1
The first solution is (−165,238)1027⋅(−165)+712⋅238=1
4. All Solutions:
a⋅x+b⋅y=1First solution (x0, y0)All solutions (x0+z⋅bgcd(a,b), y0−z⋅agcd(a,b))
1027⋅x+712⋅y=1First solution (x0=−165, y0=238)All solutions (−165+z⋅7121, 238−z⋅10271)
we have:
{ ( −165+712⋅z, 238−1027⋅z) | z∈Z }