Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things

Re: Simple primality testing

by TedYoung (Deacon)
on Nov 22, 2005 at 21:41 UTC ( #510925=note: print w/replies, xml ) Need Help??

in reply to Simple primality testing

My favourite way to test primality is:

sub is_prime { ('1' x shift) !~ /^(11+)\1+$/ }


Ted Young

($$<<$$=>$$<=>$$<=$$>>$$) always returns 1. :-)

Replies are listed 'Best First'.
Re^2: Simple primality testing
by ambrus (Abbot) on Jun 18, 2009 at 21:06 UTC

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://510925]
[choroba]: Has Jára Cimrman ever been to Bielefeld?
[marinersk]: choroba LOL wow, y'all are on a roll today.
[Eily]: nice post count marinersk
[Eily]: I also like that this number appears right below "Priest"
[marinersk]: LOL OMG. I may have to create a new account and leave this one here.
[marinersk]: Or maybe I'll just not ever post again. That would make several Monks happy.
[hippo]: :-)

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (6)
As of 2017-05-29 15:09 GMT
Find Nodes?
    Voting Booth?