summaryrefslogtreecommitdiff
path: root/math/multInv.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'math/multInv.cpp')
-rw-r--r--math/multInv.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/math/multInv.cpp b/math/multInv.cpp
new file mode 100644
index 0000000..f9db815
--- /dev/null
+++ b/math/multInv.cpp
@@ -0,0 +1,5 @@
+ll multInv(ll n, ll p) { //berechnet das multiplikative Inverse von n in F_p
+ extendedEuclid(n, p); //implementierung von oben
+ x += ((x / p) + 1) * p;
+ return x % p;
+} \ No newline at end of file