# (Solved) : Write Following Python Script Need Help Part 3c Also 3c Stray 0 Ignore Far Q42686004 . . .

write the following in a python script.

I need help with part 3c. Also on 3c there is a stray 0 so justignore it.This is what I have so far

Write the functions described below to your script. Be sure to include docstrings and some comments. (a) Write a function XGCD(a,b) which takes as input 2 non-negative integers a,b and returns the [d, s, t, where d gcd(a, b) and s and t are integers so that d= sa tb. Your code should implement the Extended Euclidean algorithm as described in lecture or on page 273 of the textbook or in the lecture notes. (b) Use your XGCD code on a = 1873452387876123 and b = 2664867585108574408 to find the greatest common divisor d and integers s,t so that as + bt = d (c) Write a function inv_mod (a,m) that uses your function XGCD to find b such that a b 0mod m=1 and prints an error message if such a b cannot be found. (d) Use inv_mod to (try to) find the inverses of 2, 3, 42, 617, and 619 modulo 634786876 and modulo 634786939 print (“3a”) def XGCD (a,b) r1,sl,t1,r2, s2,t2=a,1,0,b, 0,1 r-r2 while r!=0: q, r-divmod (rl,r2) s s1-q*s2 t-t1-q*t2 r1,sl,tl,r2,s2,t2=r2, s2,t2,r,s,t return [rl,s1,t1] print (“3b”) print (XGCD (1873452387876123,2664867585108574408)) print (“3c”) def inv mod (a,m): Show transcribed image text Write the functions described below to your script. Be sure to include docstrings and some comments. (a) Write a function XGCD(a,b) which takes as input 2 non-negative integers a,b and returns the [d, s, t, where d gcd(a, b) and s and t are integers so that d= sa tb. Your code should implement the Extended Euclidean algorithm as described in lecture or on page 273 of the textbook or in the lecture notes. (b) Use your XGCD code on a = 1873452387876123 and b = 2664867585108574408 to find the greatest common divisor d and integers s,t so that as + bt = d (c) Write a function inv_mod (a,m) that uses your function XGCD to find b such that a b 0mod m=1 and prints an error message if such a b cannot be found. (d) Use inv_mod to (try to) find the inverses of 2, 3, 42, 617, and 619 modulo 634786876 and modulo 634786939
print (“3a”) def XGCD (a,b) r1,sl,t1,r2, s2,t2=a,1,0,b, 0,1 r-r2 while r!=0: q, r-divmod (rl,r2) s s1-q*s2 t-t1-q*t2 r1,sl,tl,r2,s2,t2=r2, s2,t2,r,s,t return [rl,s1,t1] print (“3b”) print (XGCD (1873452387876123,2664867585108574408)) print (“3c”) def inv mod (a,m):

Answer to write the following in a python script. I need help with part 3c. Also on 3c there is a stray 0 so just ignore it.This i…

We are the best freelance writing portal. Looking for online writing, editing or proofreading jobs? We have plenty of writing assignments to handle.