3 ms·
This is clever and impressive. For what it's worth, though, it is possible because most scripting languages make regular expressions more powerful by allowing
by paulgb 17y ago
This is clever and impressive.
For what it's worth, though, it is possible because most scripting languages make regular expressions more powerful by allowing you to match against previously captured values. As formally defined, regular expressions are not powerful enough to check whether an arbitrary number is prime.
- endtime 17y agoI was thinking the same thing. IIRC, the language of prime numbers isn't context-free, either. Though to be fair, since the universe is finite, no existing computer is powerful enough to check if an arbitrarily large number is prime.