isPrime method
Checks if this integer is a prime number.
Implementation
bool isPrime() {
if (this <= 1) return false;
for (var i = 2; i <= math.sqrt(this).toInt(); i++) {
if (this % i == 0) return false;
}
return true;
}
Checks if this integer is a prime number.
bool isPrime() {
if (this <= 1) return false;
for (var i = 2; i <= math.sqrt(this).toInt(); i++) {
if (this % i == 0) return false;
}
return true;
}