TE
TechEcho
Home
24h Top
Newest
Best
Ask
Show
Jobs
English
GitHub
Twitter
Home
Regular Expression That Checks If a Number Is Prime (2016)
4 points
by
jagtodeath
over 5 years ago
1 comment
jagtodeath
over 5 years ago
A python implementation of is_prime(n):<p><pre><code> return re.compile(r'^1?$|^(11+)\1+$').match('1' * n) is None</code></pre>