User Tools

Site Tools


notes:discrete:fall2022:projects:cnv0

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
notes:discrete:fall2022:projects:cnv0 [2022/09/18 15:54] – [VERIFICATION] hcordellnotes:discrete:fall2022:projects:cnv0 [2022/09/22 01:56] (current) – [PROGRAM] dmuck
Line 26: Line 26:
 The n-ary value of something is determined by the number of "factor pairs" it possesses. For those who may have forgotten, a number's factors are the lesser numbers that multiply together to equal the number. For example, 2 has 1 factor pair, namely (1,2). Therefore, 2 has a n-ary value of 1 (or is a prime number). 4 would have two factor pairs, being (1,2 and 2,4). Thus an n-ary value of 2. The n-ary value of something is determined by the number of "factor pairs" it possesses. For those who may have forgotten, a number's factors are the lesser numbers that multiply together to equal the number. For example, 2 has 1 factor pair, namely (1,2). Therefore, 2 has a n-ary value of 1 (or is a prime number). 4 would have two factor pairs, being (1,2 and 2,4). Thus an n-ary value of 2.
 =====ALGORITHM: trial by division===== =====ALGORITHM: trial by division=====
 +Somewhere in the algorithm you may need to make use of the modulo (%) operator. The modulo operator gives you the remainder after a division. For example 5 % 2 would give you 1, since there is a remainder of 1 after dividing 5 by 2. This operator can be used to check if the result of two numbers being divided is a whole number (divider % divisor == 0).
 =====SPECIFICATIONS===== =====SPECIFICATIONS=====
  
Line 43: Line 43:
  
 Once you've grabbed the cnv0 project directory, with the **grabit** command, you will have a skeleton source code file. This source code contains structs, functions, and a fprintf statement that will calculate how long it takes for your program to finish processing. This is only for timekeeping and referencing, it will not be used to calculate data in our algorithms. //(gotta confirm with Matt if this information is correct)//* Once you've grabbed the cnv0 project directory, with the **grabit** command, you will have a skeleton source code file. This source code contains structs, functions, and a fprintf statement that will calculate how long it takes for your program to finish processing. This is only for timekeeping and referencing, it will not be used to calculate data in our algorithms. //(gotta confirm with Matt if this information is correct)//*
 +
 +**Note:** If you are coding this project in c++ you should modify the Makefile that way make can still build the project. To do this go to the top of the make file and change CC=gcc to CC=g++, as well as removing the flag —-std=gnu18 two lines above.
  
 The cnv0 program will accept 4 arguments, two are mandatory and two are optional. The cnv0 program will accept 4 arguments, two are mandatory and two are optional.
Line 67: Line 69:
 The start argument is the lower bound of where the program will begin to check for n-ary numbers. The start argument is the lower bound of where the program will begin to check for n-ary numbers.
  
-The end argument is the upper bound of where the program will stop to check for n-ary values.+The end argument is the upper bound of where the program will stop checking for n-ary values.
  
 Hence, if you have the following case: Hence, if you have the following case:
 <cli>  <cli> 
 lab46:~/src/SEMESTER/DESIG/PROJECT$ ./cnv0 5 1 7 20 lab46:~/src/SEMESTER/DESIG/PROJECT$ ./cnv0 5 1 7 20
- 
 7 11 13 17 19 7 11 13 17 19
 </cli> </cli>
Line 81: Line 82:
  
 =====OUTPUT SPECIFICATIONS===== =====OUTPUT SPECIFICATIONS=====
-Output should be a space separated list of matching n-ary values with a newline at the end+Output should be a space separated list of matching n-ary values with a newline at the end. Beneath that should be the amount of time it took for your script to complete. This doesn't matter for this project but in the next iteration, cnv1, we will be looking at the time and optimizing the amount of time it takes for the script to complete. The time it takes should be already included in your cnv0.c file, just make sure that your values have a newline at the end of the output.
 =====VERIFICATION===== =====VERIFICATION=====
-There is no verify file so in order to verify that your script is working correctly, you can do this manually. To do so, you can enter values into your script, figure out what the output should be, and see if your script outputs that. If it doesn't match, check if either your script doesn't work correctly, or if you did your math wrong. You can also use the example above with the arguments specified to see if you get the correct output from your script.+There is no verify file so in order to verify that your script is working correctly, you can do this manually. To do so, you can enter values into your script, figure out what the output should be, and see if your script outputs that. If it doesn't match, check if either your script doesn't work correctly, or if you did your math wrong. You can also use the example below and compare your output. 
 + 
 +<cli> 
 +lab46:~/src/SEMESTER/DESIG/PROJECT$ ./cnv0 7 1 0 16 
 +1 2 3 5 7 11 13 
 +  x.xxxx (Time) 
 +</cli> 
 + 
 +<cli> 
 +lab46:~/src/SEMESTER/DESIG/PROJECT$ ./cnv0 7 2 0 16 
 +4 6 8 9 10 14 15 
 +  x.xxxx (Time) 
 +</cli> 
 + 
 +<cli> 
 +lab46:~/src/SEMESTER/DESIG/PROJECT$ ./cnv0 7 3 0 16 
 +12 16 
 +  x.xxxx (Time) 
 +</cli> 
 + 
 + 
notes/discrete/fall2022/projects/cnv0.1663516454.txt.gz · Last modified: 2022/09/18 15:54 by hcordell