Created
November 7, 2017 19:30
-
-
Save skrosoft/cddcbf37d7ff479a60c237c7c4f248a1 to your computer and use it in GitHub Desktop.
60 primeros Números Primos terminando por 7
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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