3 ms·Regular Expression That Checks If a Number Is Prime (2016)4 points by jagtodeath 7y agojagtodeath 7y agoA python implementation of is_prime(n): return re.compile(r'^1?$|^(11+)\1+$').match('1' * n) is None