http://qs1969.pair.com?node_id=143821


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