diff --git a/code/mathematics/miller_rabin.cpp b/code/mathematics/miller_rabin.cpp index 6f3801d..bcb2f77 100644 --- a/code/mathematics/miller_rabin.cpp +++ b/code/mathematics/miller_rabin.cpp @@ -5,7 +5,7 @@ bool is_probable_prime(ll n, int k) { int s = 0; ll d = n - 1; while (~d & 1) d >>= 1, s++; while (k--) { - ll a = uniform_int_distribution(2LL, n-1)(rng); + ll a = uniform_int_distribution(2LL, n-2)(rng); ll x = mod_pow(a, d, n); if (x == 1 || x == n - 1) continue; bool ok = false;