Illya Gerasymchuk personal blog

Demystifying the regular expression that checks if a number is prime (2016)

Ever wondered how the ^.?$|^(..+?)\1+$ regular expression can tell you if a number is not prime? In this blog post you'll learn how and why it works. Code examples in Java, JavaScript, Python and Perl are provided.
Points
159
HN comments
47
Submissions
1
Cited by
0 commenters

Math & AlgorithmsSoftware Engineering2024

On Hacker News

SubmittedTitle on HNPointsComments
Oct 31, 2024Demystifying the regular expression that checks if a number is prime (2016) by aquir15947

Related posts from the same era