Last active
August 28, 2018 05:38
-
-
Save lienista/6d2a725c3d3ac40145db5257e8fbfdc7 to your computer and use it in GitHub Desktop.
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
| const isPrime = (n) => { | |
| if(n<3) return false; | |
| if(n%2===0) return false; | |
| if(n%3===0) return false; | |
| let limit = Math.sqrt(n); | |
| for(let i=5; i<=limit; i+=6){ | |
| if(num%i ===0) return false; | |
| if(num%(i+2) ===0) return false; | |
| } | |
| return true; | |
| }; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment