Comp Sci never ceases to amaze me. It is so interesting that there is a trend of doing things in unexpected/strange ways, even if inefficient, just to show it can be done that way. I would have...
Comp Sci never ceases to amaze me. It is so interesting that there is a trend of doing things in unexpected/strange ways, even if inefficient, just to show it can be done that way. I would have never imagined that RegEx could test for primality, and especially not with so short a pattern!
In case anyone else is confused, the numbers in this article are represented in unary. I.e.
0:
1: 1
2: 11
3: 111
I once had a CS professor be so bold as to claim there was no such thing as unary.
Comp Sci never ceases to amaze me. It is so interesting that there is a trend of doing things in unexpected/strange ways, even if inefficient, just to show it can be done that way. I would have never imagined that RegEx could test for primality, and especially not with so short a pattern!