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

Function factors

test/unittest/math_test.cpp:231–243  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

229}
230
231std::vector<int> factors(int m) {
232 std::vector<int> result;
233 for (int i = 2; (ll)(i)*i <= m; i++) {
234 if (m % i == 0) {
235 result.push_back(i);
236 while (m % i == 0) {
237 m /= i;
238 }
239 }
240 }
241 if (m > 1) result.push_back(m);
242 return result;
243}
244
245bool is_primitive_root(int m, int g) {
246 assert(1 <= g && g < m);

Callers 3

is_primitive_rootFunction · 0.70
is_primitive_root_naiveFunction · 0.70
TESTFunction · 0.50

Calls

no outgoing calls

Tested by

no test coverage detected