Enumeration of prime numbers 0.1

The Prime Time command line program allows you to enumerate all the prime numbers up to a specified number and it also lets you know how long it takes. The binaries has been compiled for x86 as well as an x64 specific version. In addition to the binaries you can also download the source code which is licensed under the GPL version 2.0. The program is written in C# and so it requires that one of those .NET framework things are installed. I have no clue as to which version of .NET you need. All I know is that I wrote this in Visual Studio 2005.

If you are interested in benchmarks and performance metrics you might want to know that my Dell XPS M170 laptop (Intel Pentium M 2.13 GHz, 2 GB DDR2 PC4200) takes an average of 5.211 seconds to find all the prime numbers up to 10 million (not the 10 million first prime numbers, but all the prime numbers up to the number 10 000 000). I used the command line:

primetime --max-prime 10000000 --runs 10

It uses a very simple algorithm to enumerate all the primes. What it does is to divide each odd number, starting from 3, on every prime below it (well, actually every prime up to the square root of the number being tested). If all of the divisions has a non-zero remainder, then the number is added to the list of primes and the next odd number is tested.

NOTE: This post has been imported from my old it’s learning ePortfolio project blog.

Advertisements

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: