And technically by wich number other than 1 can 1 be divided to give an integer ?
For the benchmark it's right they should be compared on the same server.
If you want to do so on your own server just follow these instructions for my program :
(1) Create the "prime_numbers.php" file and import...
The difference between our algorithms can only be seen on very large numbers. I modified my example to be similar to yours.
Try on your page 23400000 to 23410000 (that is 10,000 !!!) and then try them on mine :
http://denis.capart.free.fr/php/prime_numbers.php
On yours the 30 secs...
I did it !!!
Here is the final "primes" function, it's incredibly fast.
If you created the primes_inc.php as I showed previously just replace this function. Usage of the function is the same.
------
function primes( $n, $debug )
{
global $prime_number;
$result = "";
$root = floor( sqrt(...
Sorry, I made a little mistake in the example, I forgot "$debug" argument in the call of the functions !!! ((=:
I also forgot to say that "primes" function could be improved based on the hard coded primes table. I'll try to do it in a near future... if none of you does !!! (=;
------
<?PHP...
This should do the job.
I wrote it as an include file "primes_inc.php".
First prime numbers are "hard coded" up to 100. The procedures extend (function "extend_primes") this table as needed if you ask numbers above "10,000".
These functions check only modulos by prime numbers up to the square...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.