Created
January 4, 2017 05:47
-
-
Save 1yx/ff613d7049df71da206c7acc99685e56 to your computer and use it in GitHub Desktop.
check prime number use regex back reference in Javascript.
This file contains 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
module.exports = (n) => { | |
return '1'.repeat(n) !== '1'.repeat(n).match(/1?$|(11+?)\1+$/)[0]; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment