MCPcopy Create free account
hub / github.com/atcoder/ac-library / is_primitive_root

Function is_primitive_root

test/utils/math.hpp:20–26  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

18}
19
20bool is_primitive_root(int m, int g) {
21 assert(1 <= g && g < m);
22 for (int x : factors(m - 1)) {
23 if (atcoder::internal::pow_mod_constexpr(g, (m - 1) / x, m) == 1) return false;
24 }
25 return true;
26}

Callers

nothing calls this directly

Calls 2

pow_mod_constexprFunction · 0.85
factorsFunction · 0.70

Tested by

no test coverage detected