Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Re^3: Prime Number Finder

by Anonymous Monk
on Mar 07, 2005 at 14:41 UTC ( #437224=note: print w/ replies, xml ) Need Help??


in reply to Re: Re: Prime Number Finder
in thread Prime Number Finder

How does this work?


Comment on Re^3: Prime Number Finder
Re^4: Prime Number Finder
by tall_man (Parson) on Mar 08, 2005 at 00:04 UTC
    The regular expression match tries to break the string "111.." (a string of 1's as long as your input number) into some number of equal-length pieces of length two or more. It uses non-greedy matching, so it starts with the smallest possible and works up.. "11","111","1111" and so on. This is the same order of efficiency as the OP's prime test loop (one at a time), but it uses the regular expression engine.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (4)
As of 2014-08-22 00:36 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The best computer themed movie is:











    Results (144 votes), past polls