TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Regular Expression That Checks If a Number Is Prime (2016)

4 pointsby jagtodeathover 5 years ago

1 comment

jagtodeathover 5 years ago
A python implementation of is_prime(n):<p><pre><code> return re.compile(r&#x27;^1?$|^(11+)\1+$&#x27;).match(&#x27;1&#x27; * n) is None</code></pre>