A Perl programmer is asked to write a script to find all the prime numbers. They finish in 5 minutes. "How did you do it so fast?" asks their coworker. "I just used the is_prime function," they reply. "But Perl doesn't have an is_prime function!" yells back the coworker. The Perl programmer laughs. "I know. I wrote it in three lines."
@nixCraft And moreover, as a regular expression.

@michal @nixCraft
sub is_prime {
return !((1x$_[0]) =~ /^.?$|^(..+?)\1+$/);
}

(from illya.sh/the-codeumentary-blog…)

Demystifying The Regular Expression That Checks If A Number Is Prime

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.

The Codeumentary
@nixCraft i don’t really get the joke — it’s not hard to write a three-line is_prime function
@peterhoneyman @nixCraft I'm not a mathematician, but I am under the impression that "find all the prime numbers", implying that this has to happen happen within finite time and space, is an impossible requirement. Not sure if that's the point of the joke or just sloppiness.
@nixCraft we do not have a practical algorithm for
factoring extremely large numbers
@nixCraft All prime numbers? I think I spotted a bug in that Python script. 🥴 🥳