We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 6bf9496 commit ecad8e5Copy full SHA for ecad8e5
Math/modular_multiplicative_inverse/mmi.py
@@ -0,0 +1,17 @@
1
+# Python 3 program to find modular
2
+# inverse of a under modulo m
3
+
4
+# A naive method to find modulor
5
+# multiplicative inverse of 'a'
6
+# under modulo 'm'
7
+def modInverse(a, m) :
8
+ a = a % m;
9
+ for x in range(1, m) :
10
+ if ((a * x) % m == 1) :
11
+ return x
12
+ return 1
13
14
+# Driver Program
15
+a = 3
16
+m = 11
17
+print(modInverse(a, m))
0 commit comments