Plot Primes

Important Disclaimer

To the best of my knowledge all the source code and executables on this site work without any problems. However, I give no assurances. If you use anything on this site you use it at your own risk. If you're not sure about running executables, you should download the source code, check it yourself, and then compile it. If you have any queries, comments or suggestions then please email me at craig@craigsarea.com.

This program opens a list of prime numbers and then performs a mod 5 on each number. The result of the mod 5 moves the drawing location around the screen. At each location a point is drawn. The colour of each point drawn starts at dark green. If a point has already been drawn in the colour of the point is made lighter.

The format of the prime number list is in ASCII with one prime number on each line. For example,


You should note that no error checking is performed on the prime number list.

I've used a sieve program to generate the prime number list. You can download it from here (this is an external link). Here's an example of using it from the command line:

sieve2310.exe -s 1 -e 10000000 > number_list.txt

To plot a prime number island just run the program and select File->Open and select your prime number list.  Then select Command->Plot.  Once the drawing has finished you can save the results as a BMP file by selecting File->Save.  You can change the drawing size by selecting Command->Setup.

The program is written in C using WIN32. I've used the free (for non comercial use) LCC (not GCC) compiler, which can be downloaded from here. It's a very good compiler, but I've had problems with the editor. I recommend using it from the command line.


Download the executable by clicking here.

View the C source code as HTML by clicking here.

Download the C source code file by clicking here.

Download the Makefile by clicking here. This produces an executable called test.exe.

Download the resource file by clicking here.

Download the resource header file by clicking here.

Download a sieve program to generate prime number lists from here. Note that this is an external link. The sieve program wasn't written by me.