Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Re: is it prime?

by brx (Pilgrim)
on May 06, 2012 at 14:21 UTC ( [id://969141]=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    sub isPrime($) {
        $n=pop;
        1^(1x$n--)=~/^(1{2,$n})\1+$/;
    }
    
  2. or download this
    sub isPrime($) {
       (1x pop)!~/^(11+)\1+$/
    }
    

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others exploiting the Monastery: (7)
As of 2024-04-23 09:44 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found