We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 5889261 commit 91c77a9Copy full SHA for 91c77a9
1 file changed
src/alfred/math/utils.hpp
@@ -7,9 +7,10 @@
7
8
// O(sqrt(x)) to judge if x is a prime.
9
// It will be re-written in Miller-rabin sometime.
10
-constexpr bool is_prime(long long x) {
+template <class T>
11
+constexpr bool is_prime(T x) {
12
if (x < 2) return false;
- for (long long i = 2; i * i <= x; i++) {
13
+ for (T i = 2; i * i <= x; i++) {
14
if (x % i == 0) return false;
15
}
16
return true;
0 commit comments