function isPrime(num) {
if (num <= 1) return false;
if (num <= 3) return true;
if (num % 2 === 0 || num % 3 === 0) return false;
const sqrt = Math.sqrt(num);
for (let i = 5; i <= sqrt; i += 6) {
if (num % i === 0 || num % (i + 2) === 0) {
return false;
}
}
return true;
}
console.log(isPrime(1070));
console.log(isPrime(1453));
console.log(isPrime(1071));
console.log(isPrime(4831));
console.log(isPrime(7877));