Prime Numbers

“The Music of the Primes”

I’m ever fascinated about sequence numbers and prime numbers. So this is the why of this creation. This is my first program written in language C. All people know the power of prime numbers, they are still using in algorithms to crypt the comunications. A small definition “A prime number (or a prime) is a natural number greater than 1 that has no positive divisors other than 1 and itself” that enclosed a powerful magic. the number 2 is the only even prime numbers by definition. I suggest to you a book: Marcus Du Sautoy, “The Music of the Primes”, Fourth Estate.

How works?

Prime Numbers has a simple algorithm that can check all divisors of a number n minor of square root of n, the algorithm don’t check the even numbers. It has a good execution speed. The program was tested on 64 bit architectures. The max range depends of the type of machine you use, in the most cases under UNIX the max range value is 18.446.744.073.709.551.615.

How to use it?

Prime Numbers must be executed by terminal and need some parameters to run good.

Usage: prime_number -f [n] -t [n] -o [file]
Options:
-f Start from [number]
-t Finish to [number]
-o Write on file

-h --help Display this information
-v Active verbose mode, shows prime numbers, else shows a percent

An Example, the prime numbers between 0 and 100:

$ ./prime_number -f 2 -t 100 -o primi.txt

Versions

Prime Numbers v1.2 (x64)

Data: 12/12/2010
Features:

Compiled on Ubuntu 10.10 x64 bit
Parametres by command line

MD5Sum: 15933b7484ae9805596847602ad5b795 prime-numbers_v1.2.zip

Prime Numbers v1.2 (Win x32/x64)

Data: 12/12/2010
Features:

Compiled on virtual machine running windows XP 32 bit
Parametres by command line

MD5Sum: 3a89f6c17d01d5df5bd7500b707524cd prime-numbers_v1.2.tar.gz