Regular expression for testing prime numbers


print "Prime" if (1 x shift) !~ /^1?$|^(11+?)\1+$/

http://mail.pm.org/pipermail/athens-pm/2003-January/000033.html

Hozzászólások

"It took me an hour before I even started to
understand it"
Majd valamikor rászánom az időt :), érdekes.