Cmpsc 101, Project Primes
Write a program ( filename : primes.pl ) which does the following :
- generate an array filled with the primes numbers from 2 to 10000
in increasing order. Use the sieve method of Eratosthenes.
- Interacts with the user of your program in two different ways :
- the user wants to know the n'th prime
- the user wants to know whether a number in the range from 2 to
10000 is a prime or a composite.
- 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