正则表达式判断素数

!/^.?$|^(..+?)\1+$/.test(Array(你的数字+1).join('1'))

返回true,则是素数;否则不是。

猜你喜欢

转载自blog.csdn.net/csm0912/article/details/83746148