Cmpsc 101, Project Primes

Write a program ( filename : primes.pl ) which does the following :
  1. generate an array filled with the primes numbers from 2 to 10000 in increasing order. Use the sieve method of Eratosthenes.
  2. Interacts with the user of your program in two different ways :
    1. the user wants to know the n'th prime
    2. the user wants to know whether a number in the range from 2 to 10000 is a prime or a composite.
    3. terminates execution

Objective of this exercise is to utilize "while" loops, if-statements and "arrays" to create an efficient algorithmus (Sieve of Eratosthenes). Of course, you got to know first what a prime and what a composite number is.


Zig Herzog; hgn@psu.edu
Send a Note to Zig
Last revised: 11/01/04