Skip to content

Instantly share code, notes, and snippets.

@skrosoft
Created November 7, 2017 19:30
Show Gist options
  • Save skrosoft/cddcbf37d7ff479a60c237c7c4f248a1 to your computer and use it in GitHub Desktop.
Save skrosoft/cddcbf37d7ff479a60c237c7c4f248a1 to your computer and use it in GitHub Desktop.
60 primeros Números Primos terminando por 7
function isPrime(num) {
var prime = num != 1;
for (var i = 2; i < num; i++) {
if (num % i === 0) {
prime = false;
break;
}
}
return prime;
}
var i = 7;
var output = [];
do{
if (isPrime(i)){
output.push(i);
}
i = i + 10;
}while(output.length < 60);
console.log(output.join(', '));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment