This is an old revision of the document!
Corning Community College
CSCS1320 C/C++ Programming
~~TOC~~
To apply your skills in the implementation of prime number calculating algorithms.
In addition to the new skills required on previous projects, to successfully accomplish/perform this project, the listed resources/experiences need to be consulted/achieved:
In mathematics, a prime number is a value that is only evenly divisible by 1 and itself; it has no other factors. Numbers that have divisibility/factors are known as composite numbers.
The number 6 is a composite value, as in addition to 1 and 6, it also has the factors of 2 and 3.
The number 17 is a prime number, as no numbers other than 1 and 17 can be evenly divided.
As of yet, there is no quick and direct way of determining the primality of a given number. Instead, we must perform a series of tests to determine if it fails primality (typically by proving it is composite).
This process incurs a considerable amount of processing overhead on the task, so much so that increasingly large values take increasing amounts of time. Often, approaches to prime number calculation involve various algorithms, which offer various benefits (less time) and drawback (more complex code).
Your task for this project is to implement 3 prime number programs:
It is your task to write the program that will use the above method to compute the requested one-, two-, or three-digit value against a multiplicand of 11 (without using any multiplication to obtain your result).
Your program should:
Several operating behaviors are shown as examples.
A two digit value:
lab46:~/src/cprog/mbe0$ ./multby11 Enter value: 32 32 x 11 = 352 lab46:~/src/cprog/mbe0$
Next, a one digit value:
lab46:~/src/cprog/mbe0$ ./multby11 Enter value: 7 7 x 11 = 77 lab46:~/src/cprog/mbe0$
Finally, three digit value:
lab46:~/src/cprog/mbe0$ ./multby11 Enter value: 567 567 x 11 = 6237 lab46:~/src/cprog/mbe0$
The execution of the programs is short and simple- parse the input, do the processing, produce the output, and then terminate.
There will be an additional bonus point opportunity with this project, based on processing run-time of your optimized solution.
To successfully complete this project, the following criteria must be met:
To submit this program to me using the submit tool, run the following command at your lab46 prompt:
$ submit cprog pnc0 primebrute.c primesqrt.c primeopt.c Submitting cprog project "pnc0": -> primebrute.c(OK) -> primesqrt.c(OK) -> primeopt.c(OK) SUCCESSFULLY SUBMITTED
You should get some sort of confirmation indicating successful submission if all went according to plan. If not, check for typos and or locational mismatches.