We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent af556c8 commit 4c8d1aaCopy full SHA for 4c8d1aa
content/4_Gold/Modular.mdx
@@ -292,7 +292,7 @@ assert 2 * x % MOD == 1
292
We can also find modular inverses through Euclidean Division.
293
Given the prime modulus $m > a$ we have:
294
$m = k \cdot a + r$, where k = $floor(\frac{m}{a})$ and $r = m \mod a$. Then: $0 = k \cdot a + r \mod m \iff r = -k \cdot a \mod m
295
-\iff r \cdot a^-1 = -k \mod m \iff a^-1 = -k \mod m \cdot r^-1 \mod m$.
+\iff r \cdot a^(-1) = -k \mod m \iff a^(-1) = -k \mod m \cdot r(^-1) \mod m$.
296
297
Here is a short recursive implementation of the above formula:
298
0 commit comments