Created
November 11, 2013 02:39
-
-
Save missdeer/7406915 to your computer and use it in GitHub Desktop.
isPrime.js, regexp magic
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 isPrime(i) { | |
var ones = ""; | |
while(--i >= 0) ones += "1"; | |
return !/^1?$|^(11+?)\1+$/.test(ones); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment