This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
notes:comporg:projects:pnc0 [2018/01/21 01:43] – [Program Specifications] ahought2 | notes:comporg:projects:pnc0 [2018/01/22 13:51] (current) – [Program Output Format] bstrong2 | ||
---|---|---|---|
Line 100: | Line 100: | ||
** primereg.c / primeregb.c / primeregs.c / primeregbs.c are all REQUIRED** | ** primereg.c / primeregb.c / primeregs.c / primeregbs.c are all REQUIRED** | ||
- | Break on composite | + | **Brute Force** |
- | Square root trick: You can use the < | + | **Break on composite** - Once you can determine a number is NOT prime you can break from the the rest of the checks. |
+ | |||
+ | **Square root trick** - You can use the < | ||
+ | < | ||
+ | #include < | ||
+ | </ | ||
+ | |||
+ | **sqrt()-less square root approximation (a)-** This is optional, you would do this instead of the sqrt() function. (If you've taken discrete then you know how to do it, if you haven' | ||
---- | ---- | ||
- | **primereg** - baseline program (Brute force, no break)\\ \\ | + | **primereg.c** - baseline program (Brute force, no break)\\ \\ |
- | **primeregs** - baseline, plus square root trick (Use < | + | **primeregs.c** - baseline, plus square root trick (Use < |
- | **primeregb** - baseline, plus break on composite\\ \\ | + | **primeregb.c** - baseline, plus break on composite\\ \\ |
- | **primeregbs** - baseline, plus square root trick, plus break on composite\\ \\ | + | **primeregbs.c** - baseline, plus square root trick, plus break on composite\\ \\ |
**__Choice of A, R, or L__** \\ | **__Choice of A, R, or L__** \\ | ||
- | **primeregAbs** - baseline, array, square root trick, break on composite \\ \\ | + | **primeregAbs.c** - baseline, array, square root trick, break on composite \\ \\ |
**Note**: (Store prime divisors into array and check against the array) \\ | **Note**: (Store prime divisors into array and check against the array) \\ | ||
Array size(amount of elements) == argument 1(number of primes) \\ \\ | Array size(amount of elements) == argument 1(number of primes) \\ \\ | ||
- | **primeregRbs** - Recursive brain melter ? \\ | + | **primeregRbs.c** - Recursive brain melter ? \\ |
- | **primeregLbs** - Linked List - similar to primeregAbs - save primes in a linked list rather than an array. | + | **primeregLbs.c** - Linked List - similar to primeregAbs - save primes in a linked list rather than an array. |
Line 128: | Line 135: | ||
-**Put all c files in gcc directory from pnc0 grabit** \\ | -**Put all c files in gcc directory from pnc0 grabit** \\ | ||
- | -Numbers go to stderr, time goes to stdout \\ | + | -Numbers go to stderr, |
=====Testing===== | =====Testing===== |