Prime Detector

Due date

Before lecture on April 10.

Assignment Requirements

Students may work in groups of 1 or 2.  Each student must submit a solution to GitHub.

Create a directory in your repository named prime_detector.  In that directory include a Makefile, a README file that includes the names of your team mates, and a program named prime_detector.c that satisfies the following requirements.

  • The program accepts 2 integer arguments.  The first argument, p, is required whereas the second argument, s, is optional.
  • If a second argument is provided, the program runs for no more than s seconds.  Otherwise, it runs indefinitely.   Before terminating, the program prints to the screen the number of seconds that the program ran.
  • If the program determines that p is a prime then it prints to the screen “confirmed prime” and if it determines that p is not a prime then it prints to the screen “confirmed composite”.
  • If the program runs out of time, before terminating, the program prints “unknown”.
  • The program must use 4 threads to determine if p is prime.

Also include in your repository a file named proof.pdf that describes the algorithm that you used to solve the problem and provides a proof of its correctness and completeness.

Grading

  • Grades will be based on speed in which a prime number can be confirmed and the sophistication of the algorithm used.
  • It is advised that you and your team perform research to find an efficient algorithm that satisfies the assignment requirements and is efficient before you begin programming.

 

© 2019, Eric. All rights reserved.