We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 5a0c53f commit cefe411Copy full SHA for cefe411
1 file changed
code/mathematics/miller_rabin.cpp
@@ -5,7 +5,7 @@ bool is_probable_prime(ll n, int k) {
5
int s = 0; ll d = n - 1;
6
while (~d & 1) d >>= 1, s++;
7
while (k--) {
8
- ll a = uniform_int_distribution(2LL, n-1)(rng);
+ ll a = uniform_int_distribution(2LL, n-2)(rng);
9
ll x = mod_pow(a, d, n);
10
if (x == 1 || x == n - 1) continue;
11
bool ok = false;
0 commit comments