diff options
Diffstat (limited to 'math/discreteLogarithm.cpp')
| -rw-r--r-- | math/discreteLogarithm.cpp | 14 |
1 files changed, 0 insertions, 14 deletions
diff --git a/math/discreteLogarithm.cpp b/math/discreteLogarithm.cpp deleted file mode 100644 index d9227b9..0000000 --- a/math/discreteLogarithm.cpp +++ /dev/null @@ -1,14 +0,0 @@ -ll dlog(ll a, ll b, ll m) { - ll bound = sqrtl(m) + 1; //memory usage bound - map<ll, ll> vals; - for (ll i = 0, e = 1; i < bound; i++, e = (e * a) % m) { - vals[e] = i; - } - ll fact = powMod(a, m - bound - 1, m); - - for (ll i = 0; i < m; i += bound, b = (b * fact) % m) { - if (vals.count(b)) { - return i + vals[b]; - }} - return -1; -} |
