summaryrefslogtreecommitdiff
path: root/math/shortModInv.cpp
diff options
context:
space:
mode:
authorMZuenni <michi.zuendorf@gmail.com>2024-06-28 13:47:18 +0200
committerMZuenni <michi.zuendorf@gmail.com>2024-06-28 13:47:18 +0200
commit65d2ac37862ce9d1de208a05099c281863e66256 (patch)
treed1fe1ece8790e8e8b2a8bcd3895f82477b3a0e2b /math/shortModInv.cpp
parenta3c9198048cf465a3c01827b3667edfc99d8031c (diff)
parent366ff0a4ba0c94f5cdc2cbd4e2c991ad0b544522 (diff)
merge
Diffstat (limited to 'math/shortModInv.cpp')
-rw-r--r--math/shortModInv.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/math/shortModInv.cpp b/math/shortModInv.cpp
index 747eb7a..244bacf 100644
--- a/math/shortModInv.cpp
+++ b/math/shortModInv.cpp
@@ -1,3 +1,3 @@
-ll inv(ll a, ll b){ // a^{-1} mod b
- return 1 < a ? b - inv(b % a, a) * b / a : 1;
-} \ No newline at end of file
+ll multInv(ll x, ll m) { // x^{-1} mod m
+ return 1 < x ? m - inv(m % x, x) * m / x : 1;
+}