Created
December 2, 2019 09:22
-
-
Save gthrm/07f2d73599cf25d2aac1b6313b24f39b to your computer and use it in GitHub Desktop.
Проверка на простое число JS
This file contains hidden or 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 primality(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