leafiy
5/18/2018 - 6:47 PM

判断质数 #js #regex

none

function isPrime(n) {
  return !(/^.?$|^(..+?)\1+$/).test('1'.repeat(n))
}