cpp/math/is-prime.cpp
- View this file on GitHub
- Last update: 2024-01-29 16:29:11+09:00
Required by
Code
template <typename T>
bool isPrime(T n){
for(T i = 2; n >= i*i; i++){
if(!(n%i)){return false;}
}
return true;
}
#line 1 "cpp/math/is-prime.cpp"
template <typename T>
bool isPrime(T n){
for(T i = 2; n >= i*i; i++){
if(!(n%i)){return false;}
}
return true;
}