diff options
Diffstat (limited to 'math/discreteNthRoot.cpp')
| -rw-r--r-- | math/discreteNthRoot.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/math/discreteNthRoot.cpp b/math/discreteNthRoot.cpp new file mode 100644 index 0000000..9249f73 --- /dev/null +++ b/math/discreteNthRoot.cpp @@ -0,0 +1,5 @@ +ll root(ll a, ll b, ll m) { + ll g = findPrimitive(m); + ll c = dlog(powMod(g, a, m), b, m); //diskreter logarithmus + return c < 0 ? -1 : powMod(g, c, m); +} |
