Famous Perl One-Liners Explained, Part III: Calculations
catonmat.net
catonmat.net
For any unary integer greater than 1, the regular expression /^(11+?)\1+$/ matches it iff the number is not a prime. In other words, if there exists no integer less than the number itself and greater than one (first capturing group) that is a divisor of the number. The non-greedy + is also a nice touch, it will start out from the smallest factors and build from there.
the others I wasn't necessarily able to think of the one liner before checking the answer but I at least had a general idea of how it might be done. the primes completely stumped me.
I just thought of one actually - sum up the size of files in a directory.
Can you think of more? ... Anything that comes to your mind.