From: Xavier Noria Date: 2008-04-01T17:17:15+09:00 Subject: Re: Primes in P? On Apr 1, 2008, at 4:23 , Charles Zheng wrote: >> ((("1" * self) =~ /^1$|^(11+?)\1+$/) == nil) >> end >> end > ... >> The turnaround time on solving is almost instantaneous for this >> algorithm until the numbers start gets really big (i.e. like the >> 123457 >> above). I don't know if this matches the criteria for "polynomial >> running time" but thought you might find this interesting if you >> didn't >> know about it. >> Michael > > That is pretty cool. It is not of polynomial running time since it > tries > to factor the number brute-force, but that is a very nifty reg EXP > trick. The author is Perl hacker Abigail, it first appeared in comp.lang.perl.misc: -- fxn