diff options
| author | MZuenni <michi.zuendorf@gmail.com> | 2023-03-01 11:36:26 +0100 |
|---|---|---|
| committer | MZuenni <michi.zuendorf@gmail.com> | 2023-03-01 11:36:26 +0100 |
| commit | 12afe719ce268bb10aa93a910079a44eb08999b8 (patch) | |
| tree | 0937a117287eebe3942e0506d27143eff4980d09 /math/primitiveRoot.cpp | |
| parent | ad8456f7c5d44d3c647b3a368050a5d2f39ae3c3 (diff) | |
removed trailing whitespaces and use more structured bindings
Diffstat (limited to 'math/primitiveRoot.cpp')
| -rw-r--r-- | math/primitiveRoot.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/math/primitiveRoot.cpp b/math/primitiveRoot.cpp index 7973c24..464bdb3 100644 --- a/math/primitiveRoot.cpp +++ b/math/primitiveRoot.cpp @@ -1,12 +1,12 @@ bool isPrimitive(ll g, ll n, ll phi, map<ll, int> phiFacs) { if (g == 1) return n == 2; - for (auto& f : phiFacs) - if (1 == powMod(g, phi / f.first, n)) return false; + for (auto [f, _] : phiFacs) + if (powMod(g, phi / f, n) == 1) return false; return true; } bool isPrimitive(ll g, ll n) { - ll phin = phi(n); //isPrime(n) => phi(n) = n - 1 + ll phin = phi(n); //isPrime(n) => phi(n) = n - 1 map<ll, int> phiFacs; factor(phin, phiFacs); return isPrimitive(g, n, phin, phiFacs); |
