Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re: Prime Number Finder

by Cybercosis (Monk)
on Feb 07, 2002 at 09:09 UTC ( #143821=note: print w/replies, xml ) Need Help??


in reply to Prime Number Finder

Eep! The brute-force approach! Well, if you must, you might as well cut calculation time somewhat:
-You only have to check the numbers up to one-half of the number you are testing, because the second half are multiplied by the first half to get the number.
-Multiples of numbers that you've already checked can be skipped.

~Cybercosis

nemo accipere quod non merere

Replies are listed 'Best First'.
Re: Re: Prime Number Finder
by Zaxo (Archbishop) on Feb 07, 2002 at 11:11 UTC
    You only have to check the numbers up to one-half of the number you are testing...

    s/one-half/square root/;

    After Compline,
    Zaxo

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://143821]
help
Chatterbox?
[1nickt]: I think it is indubitably fast. But it's not a drop in replacement. And I tend to be leery of putting too many eggs in these one-man baskets.
[LanX]: interesting the author doesn't seem to accept javascript as a scripting language
[LanX]: ... and calls php7 the winner oO

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (5)
As of 2017-05-22 20:35 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?