2022-10-27 15:07:13 +00:00
|
|
|
export function isPrime(value) {
|
2022-11-01 14:08:35 +00:00
|
|
|
if (value <= 1) return false;
|
|
|
|
|
|
|
|
for (let divisor = 2; divisor <= Math.sqrt(value); divisor++) {
|
|
|
|
if (value % divisor === 0) {
|
|
|
|
return false
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return true
|
2022-10-27 15:07:13 +00:00
|
|
|
}
|