Skip to content

Commit

Permalink
Merge pull request #1156 from adamant-pwn/patch-2
Browse files Browse the repository at this point in the history
Do not accept 0 as primitive root modulo p
  • Loading branch information
maspypy authored May 14, 2024
2 parents fe93d16 + fc7ebb3 commit 1a7d531
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion math/primitive_root/checker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ bool check_primitive_root(ll p, ll r) {
for (auto &&[q, k]: factor(p - 1)) {
if (mod_pow_long(r, (p - 1) / q, p) == 1) return false;
}
return true;
return r != 0;
}

int main(int argc, char *argv[]) {
Expand Down

0 comments on commit 1a7d531

Please sign in to comment.