User Tools

Site Tools


Sidebar

projects

pct0 (bonus; due 20230823)
wcp1 (due 20230823)
abc0 (due 20230830)
btt0 (due 20230830)
pct1 (bonus; due 20230830)
pct2 (due 20230830)
wcp2 (due 20230830)
mpg0 (due 20230906)
pct3 (bonus; due 20230906)
wcp3 (due 20230906)
pct4 (due 20230913)
ttb0 (due 20230913)
wcp4 (due 20230913)
pct5 (bonus; due 20230920)
ttb1 (due 20230920)
wcp5 (due 20230920)
dap0 (due 20230927)
gfo0 (due 20230927)
pct6 (due 20230927)
wcp6 (due 20230927)
cgf0 (due 20231004)
pct7 (bonus; due 20231004)
wcp7 (due 20231004)
bwp1 (bonus; due 20231018)
pct8 (due 20231018)
wcp8 (due 20231018)
yol0 (due 20231018)
bjm0 (due 20231025)
pct9 (bonus; due 20231025)
wcp9 (due 20231025)
bjm1 (due 20231101)
gfo1 (due 20231101)
pctA (due 20231101)
wcpA (due 20231101)
pctB (bonus; due 20231108)
set0 (due 20231108)
wcpB (due 20231108)
mor0 (due 20231115)
pctC (due 20231115)
wcpC (due 20231115)
bwp2 (bonus; due 20231129)
pctD (bonus; due 20231129)
wcpD (bonus; due 20231129)
gfo2 (due 20231206)
pctE (bonus; due 20231206)
wcpE (bonus; due 20231206)
EoCE (due 20231214)
haas:fall2023:discrete:projects:cnv0

Corning Community College

CSCS2330 Discrete Structures

PROJECT: Computing N-ary Values (CNV0)

OBJECTIVE

To begin an exploration of algorithms, their implementation, their optimization, their efficiency, and collaboratively authoring and documenting the project and its specifications.

GRABIT

To assist with consistency across all implementations, data files for use with this project are available on lab46 via the grabit tool. Be sure to obtain it and ensure your implementation properly works with the provided data.

lab46:~/src/SEMESTER/DESIG$ grabit DESIG PROJECT

OVERVIEW

Your task is to implement a program that determines, within provided command-line constraints, the matching N-ary values.

Contributing to project documentation is also a core part of this project. If from reading the existing documentation or through your own exploring, you find something lacking, unclear, or outright missing, that is an opportunity to potentially contribute content.

You want the project documentation to provide you (as if coming in with no awareness of the project) with sufficient information so as to allow you to proceed. Asking questions on the discord is a great way of getting more information that you can use to add content.

EDIT

You will want to go here to edit and fill in the various sections of the document:

BACKGROUND

To better explain this, we gotta first ask ourselves the question: What is a prime number? How do we calculate prime numbers? What does a “prime” number mean?

A prime number is a natural number greater than 1 that is the product between the number itself times one. For example, the number 11 is a prime number because you can only obtain it by multiplying 11 X 1 = 11.

However, since multiplication is commutative, it doesn't matter how you arrange the numbers the product will be the same, therefore the factor pair is one and the same:

  • 1 x 11 = 11
  • 11 x 1 = 11

The property of a number being prime is called primality.

Taking this property into consideration, if there are prime numbers that are the product between ONE PAIR of factors, then there could be “secondary” numbers that are the product of TWO separate pairs of factors. Therefore there could be “third-ary”, a “fourth-ary”, “fifth-ary” and so on to the “N-ary” factor pairs.

Example:

  • 11 x 1 = 1
  • 14 x 1 = 14, 7 x 2 = 14
  • 12 x 1 = 12, 6 x 2 = 12, 4 x 3 = 12

Computing N values

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

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

It is our task to build a program that will calculate and display factor pairs from an n-ary number. This program will be timed and we will compare this program's computational time to future project's computational time in order to get a better understanding of the algorithms we use. The computational time of the program should start prior to your algorithm and end after. Furthermore, the computational time of your program should be output to stderr while the computed values are output to stdout.

*Our task is to ask questions on Discord or in class and document our findings on this wiki page collaboratively, regarding the functionality of this project.

*For anybody interested in editing the wiki page, here is the dokuwiki user guide: https://www.dokuwiki.org/wiki:syntax#basic_text_formatting -Ash

PROGRAM

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.

lab46:~/src/SEMESTER/DESIG/PROJECT$ ./cnv0 qty nary [start] [end]
 ./cnv0     qty    nary  [start]   [end]
argv[0] argv[1] argv[2]  argv[3] argv[4]

The first two arguments are mandatory, qty and nary.

The qty argument stands for quantity, this argument indicates how many n-ary will be displayed to output, from all the n-ary numbers available. example: If the program is looking for “second-ary” numbers, display only a quantity of 3 n-ary numbers. Therefore: 4 is second-ary, 10 is second-ary, and 14 is second-ary. (only display 3)

The nary argument stands for the n-ary degree, this argument indicates how many factor pairs a number is expected to have. 1 for n-ary is a prime number, with one factor pair, 10 for n-ary is a “tenth-ary” number with 10 factor pairs, etc.

The two last arguments are optional, start and end.

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 checking for n-ary values.

Hence, if you have the following case:

lab46:~/src/SEMESTER/DESIG/PROJECT$ ./cnv0 5 1 7 20
7 11 13 17 19

What these arguments are indicating is display 5 numbers, that are prime, start from seven, and stop at 20.

The program is to display timing information as well, with the core computation part of this project between the starting and stopping of the timer. This functionality is already included in the cnv0.c you grabbed.

OUTPUT SPECIFICATIONS

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

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.

lab46:~/src/SEMESTER/DESIG/PROJECT$ ./cnv0 7 1 0 16
1 2 3 5 7 11 13
  x.xxxx (Time)
lab46:~/src/SEMESTER/DESIG/PROJECT$ ./cnv0 7 2 0 16
4 6 8 9 10 14 15
  x.xxxx (Time)
lab46:~/src/SEMESTER/DESIG/PROJECT$ ./cnv0 7 3 0 16
12 16
  x.xxxx (Time)
 

SUBMISSION

To be successful in this project, the following criteria (or their equivalent) must be met:

  • Project must be submit on time, by the deadline.
    • Late submissions will lose 33% credit per day, with the submission window closing on the 3rd day following the deadline.
  • All code must compile cleanly (no warnings or errors)
    • Compile with the -Wall and –std=gnu18 compiler flags
    • all requested functionality must conform to stated requirements (either on this document or in a comment banner in source code files themselves).
  • Executed programs must display in a manner similar to provided output
    • output formatted, where applicable, must match that of project requirements
  • Processing must be correct based on input given and output requested
  • Output, if applicable, must be correct based on values input
  • Code must be nicely and consistently indented
  • Code must be consistently written, to strive for readability from having a consistent style throughout
  • Code must be commented
    • Any “to be implemented” comments MUST be removed
      • these “to be implemented” comments, if still present at evaluation time, will result in points being deducted.
      • Sufficient comments explaining the point of provided logic MUST be present
  • No global variables (without instructor approval), no goto statements, no calling of main()!
  • Track/version the source code in your lab46 semester repository
  • Submit a copy of your source code to me using the submit tool (make submit on lab46 will do this) by the deadline.

Submit Tool Usage

Let's say you have completed work on the project, and are ready to submit, you would do the following (assuming you have a program called uom0.c):

lab46:~/src/SEMESTER/DESIG/PROJECT$ make submit

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.

RUBRIC

I'll be evaluating the project based on the following criteria:

78:cnv0:final tally of results (78/78)
*:cnv0:used grabit to obtain project by the Sunday prior to duedate [13/13]
*:cnv0:clean compile, no compiler messages [13/13]
*:cnv0:implementation passes verification tests [13/13]
*:cnv0:adequate modifications to code from template [13/13]
*:cnv0:program operations conform to project specifications [13/13]
*:cnv0:code tracked in lab46 semester repo [13/13]

Pertaining to the collaborative authoring of project documentation

  • each class member is to participate in the contribution of relevant information and formatting of the documentation
    • minimal member contributions consist of:
      • near the class average edits (a value of at least four productive edits)
      • near the average class content change average (a value of at least 256 bytes (absolute value of data content change))
      • near the class content contribution average (a value of at least 1kiB)
      • no adding in one commit then later removing in its entirety for the sake of satisfying edit requirements
    • adding and formatting data in an organized fashion, aiming to create an informative and readable document that anyone in the class can reference
    • content contributions will be factored into a documentation coefficient, a value multiplied against your actual project submission to influence the end result:
      • no contributions, co-efficient is 0.50
      • less than minimum contributions is 0.75
      • met minimum contribution threshold is 1.00

Additionally

  • Solutions not abiding by spirit of project will be subject to a 50% overall deduction
  • Solutions not utilizing descriptive why and how comments will be subject to a 25% overall deduction
  • Solutions not utilizing indentation to promote scope and clarity or otherwise maintaining consistency in code style and presentation will be subject to a 25% overall deduction
  • Solutions not organized and easy to read (assume a terminal at least 90 characters wide, 40 characters tall) are subject to a 25% overall deduction
haas/fall2023/discrete/projects/cnv0.txt · Last modified: 2022/09/15 11:29 by 127.0.0.1