78,498 Prime Numbers

Download all prime numbers < 1,000,000 (gzipped, comma delimited) here.

2 thoughts on “78,498 Prime Numbers”

  1. PHP:

    <?
    function is_prime($i)
    {
    if($i % 2 != 1) return false;
    $d = 3;
    $x = sqrt($i);
    while ($i % $d != 0 && $d < $x) $d += 2;
    return (($i % $d == 0 && $i != $d) * 1) == 0 ? true : false;
    }

    $total = 0;
    $max = 1000000;

    for($i=0;$i<$max;$i++)
    {
    if (is_prime($i))
    {
    echo “$i is a prime number”;
    $total++;
    }
    }

    echo “Total Number of Prime Numbers between 1 and $max is $total\n”;

    ?>

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

All trademarks and copyrights on this page are owned by their respective owners. Quotes from linked articles are probably the property of the publications linked or the property of the person(s) quoted. The rest © 2001- 2024 by James A. Chappell