Question: Problem 6. Write a function ModInv (a,n) that takes as inputs two integers, a and n. If gcd(a,n)=1, your function must return the (unique) number

 Problem 6. Write a function ModInv (a,n) that takes as inputs

Problem 6. Write a function ModInv (a,n) that takes as inputs two integers, a and n. If gcd(a,n)=1, your function must return the (unique) number b such that 1bn1,ab=1(modn); if gcd(a,n)>1 and no such b exists, your function must return 1

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!