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 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
Get step-by-step solutions from verified subject matter experts
