[ProgSoc] The magic of regex
Justin Steward
althalus87 at gmail.com
Thu Nov 19 10:19:16 EST 2009
On Thu, Nov 19, 2009 at 12:36 AM, Peter Dolkens <peter.dolkens at ddrit.com> wrote:
> Take a number, generate a string that contains that many "1"s
> Match it against the following regex:
> /^1?$|^(11+?)\1+$/
> If it fails to match, you sir (or madam), have yourself a PRIME number.
That's... one of the slowest methods I've ever seen to determine if a
number is prime...
~Justin
More information about the Progsoc
mailing list