#include <logarithms.hpp>
|
uint64_t | pollard_rho_log (uint64_t a, uint64_t b, uint64_t m) |
|
uint64_t | BSGS (uint64_t a, uint64_t b, uint64_t m) |
|
- Examples
- logarithms.cpp.
Definition at line 47 of file logarithms.hpp.
◆ BSGS()
uint64_t gpmp::Logarithms::BSGS |
( |
uint64_t |
a, |
|
|
uint64_t |
b, |
|
|
uint64_t |
m |
|
) |
| |
- Examples
- logarithms.cpp.
Definition at line 98 of file logarithms.cpp.
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;
uint64_t mod_pow(uint64_t a, uint64_t b, uint64_t m)
gpmp::PrimalityTest __LOG_PRIMES__
References __LOG_PRIMES__, and gpmp::PrimalityTest::mod_pow().
Referenced by main().
◆ pollard_rho_log()
uint64_t gpmp::Logarithms::pollard_rho_log |
( |
uint64_t |
a, |
|
|
uint64_t |
b, |
|
|
uint64_t |
m |
|
) |
| |
- Examples
- logarithms.cpp.
Definition at line 58 of file logarithms.cpp.
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);
Referenced by main().
The documentation for this class was generated from the following files: