48 #include <unordered_map>
59 uint64_t x = rand() % (p - 1) + 1;
63 x = rand() % (p - 1) + 1;
69 std::unordered_map<uint64_t, uint64_t> values;
78 d = std::gcd(std::llabs(y2 - y1), p);
86 uint64_t x0 = std::llabs(y2 - y1) / d;
87 uint64_t y0 = values[x0];
93 return k * x0 % (p - 1);
99 uint64_t n = (uint64_t)sqrt(m) + 1;
101 std::unordered_map<uint64_t, uint64_t> value;
104 for (uint64_t i = n; i >= 1; --i) {
108 for (uint64_t j = 0; j < n; ++j) {
114 uint64_t ans = value[cur] * n - j;
User API for openGPMP ARITHMETIC MODULE.
uint64_t BSGS(uint64_t a, uint64_t b, uint64_t m)
uint64_t pollard_rho_log(uint64_t a, uint64_t b, uint64_t m)
uint64_t mod_pow(uint64_t a, uint64_t b, uint64_t m)
gpmp::PrimalityTest __LOG_PRIMES__