I need a way to find the 10001th prime number. My code prints out all the prime numbers but I'm not sure how to get the 10001th prime number.
function prime(nth) {
var arr = [2];
var isPrime = true;
for(var i = 3; i <= 100; i++) {
isPrime = true;
for(var j = 2; j < i; j++) {
if(i % j === 0) {
isPrime = false;
break;
}
}
if(isPrime === true) {
arr.push(i);
}
}
return arr;
}
prime();