Modular Inverse by rolf

def E(a,b):
 if b:u,v,w=E(b,a%b);return u,w,v-a/b*w
 return a,1,0
while 1:a,m=map(int,raw_input().split());print E(a,m)[1]%m

Note that non-ascii characters in the above source code will be escaped (such as \x9f).

To protect the system from spam, please input your favorite sport (hint: I believe its name must start with 'g', case insensitive)

download

return to the top page