Regular Expression That Checks If a Number Is Prime (2016)
iluxonchik.github.io
Regular Expression That Checks If a Number Is Prime (2016)
1–2 of 2 posts
Re: Regular Expression That Checks If a Number Is Prime (2016)
#2A python implementation of is_prime(n):
return re.compile(r'^1?$|^(11+)\1+$').match('1' * n) is None