8 votes

Primality test using regex

3 comments

  1. [2]
    nathan
    Link
    In case anyone else is confused, the numbers in this article are represented in unary. I.e. 0: 1: 1 2: 11 3: 111

    In case anyone else is confused, the numbers in this article are represented in unary. I.e.

    0:
    1: 1
    2: 11
    3: 111

    5 votes
    1. teaearlgraycold
      Link Parent
      I once had a CS professor be so bold as to claim there was no such thing as unary.

      I once had a CS professor be so bold as to claim there was no such thing as unary.

  2. Grendel
    Link
    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!

    4 votes