Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re: Prime number generator

by truedfx (Monk)
on Jul 22, 2006 at 11:42 UTC ( [id://563000]=note: print w/replies, xml ) Need Help??


in reply to Prime number generator

I have no idea who it was that originally came up with the idea of regexes, but I liked it and it seems appropriate here, so:

#!perl -p $_ x=(1x$_)!~/^(|.|(..+)\2+)$/
$ seq -50 50 | perl prime.pl 2 3 5 7 11 13 17 19 23 29 31 37 41 43 47

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://563000]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others rifling through the Monastery: (5)
As of 2024-04-18 06:13 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found