Skip to content

Instantly share code, notes, and snippets.

@gthrm
Created December 2, 2019 09:22
Show Gist options
  • Save gthrm/07f2d73599cf25d2aac1b6313b24f39b to your computer and use it in GitHub Desktop.
Save gthrm/07f2d73599cf25d2aac1b6313b24f39b to your computer and use it in GitHub Desktop.
Проверка на простое число JS
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