Skip to content

Instantly share code, notes, and snippets.

@ZackFox
Last active April 5, 2019 13:34
Show Gist options
  • Save ZackFox/4913e0af4eab9e47a1c0219b96b327c6 to your computer and use it in GitHub Desktop.
Save ZackFox/4913e0af4eab9e47a1c0219b96b327c6 to your computer and use it in GitHub Desktop.
// число является простым если делится без остатка только на себя и 1
// т.е ни на одно перед собой
function isPrime(n){
for(let i = 2; i < n; i++){
if(n % i === 0){
return false;
}
}
return n > 1;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment