Work 08: The Prime Directive

posted Oct 19, 2018, 7:17 AM by JonAlf Dyrland-Weaver   [ updated Oct 26, 2018, 7:36 AM ]
No, not that prime directive.

Use the Sieve of Eratosthenes to write a function that will find the nth prime number.

You can use the following driver file, especially if you plan on entering the contest of champions later next week: https://github.com/mks65/sieve/blob/master/main.c

Regardless, you must provide your sieve and associated code (I see you makefile!) on GitHub:

https://github.com/mks65/sieve.git

Kontest Requirements:
  • Submit a link to your repo here: (ONLY if you want to enter the competition)
  •  You must make a repo and place sieve.h and sieve.c inside that directory, not a subdirectory:
  • Your sieve.h should have the function:
    • int sieve(int targetPrime);
  • There should be no printed output when sieve() is called!
  • I will use a driver of mine.
  • I will compile with the -lm flag so you can use math.h.
  • Optionally:
    • In your makefile, you can pass args to the program:
    • run:
      • ./primetest $(args)
  • Then you can use the shell as follows: 
  • make run args="100000 10"
Comments