This repo contains implementations of a Sieve of Eratosthenes, an algorithm to find prime numbers up to N. It does this by creating a list, starting at 2, and runs through each integer and removes all composite digits. There is one implementation in C, one in ML, and one in Elixir.
- Clone repo
cd to/C/directory- run
make - run
./primesMT+-t num_threads -u upper_boundwhere num_threads is the number of threads you want to dedicate and upper_bound is the highest possible prime to find - Or to run automated tests this will execute and time for various upper bounds and threads. Use
./testPrimesC
cd to/Elixir/directory- run
elixir primesMT.exand follow prompt
- Enter ML directory
- run the bash script
./testSMLto run the automated tests. - or
./any of the programs to test individually ex./500KPrimes - Otherwise edit line number 46
val myPrimes = primes( "Place Upper Bound Here" ); - After changing primesMT.sml can be compiled with mlton using
mlton primesMT.sml - Then execute.