Question: Write a python program that takes as input four integers (b,m,c,n) with gcd(m,n)=1 and computes an integer x with satisfying x b (mod m) and
Write a python program that takes as input four integers (b,m,c,n) with gcd(m,n)=1 and computes an integer x with
satisfying
x
b (mod m) and x
c (mod m)
DONT USE BRUTE FORCE
def egcd(a,b): """Find gcd(a,b) and x,y s.t ax+by=gcd""" if b==0: return a,1,0 x=1 g=a v=0 w=b while w!=0: x=v g=w v=x-(g//w)*v w=g%w x=x%(b//g) return g,x,(g-a*x)//b
0
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
