Skip to content

Instantly share code, notes, and snippets.

@ericsong
Created December 7, 2015 03:42
Show Gist options
  • Save ericsong/a35d932d0783d311b81d to your computer and use it in GitHub Desktop.
Save ericsong/a35d932d0783d311b81d to your computer and use it in GitHub Desktop.
var primeCount = 0;
for(var i = 2 ;; i++) {
var isPrime = true;
for(var j = 2; j < i; j++) {
if(i % j == 0) {
isPrime = false;
break;
}
}
if(isPrime) {
primeCount++;
}
if(primeCount == 10001) {
console.log(i);
break;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment