User Tools

Site Tools


notes:discrete:fall2022:projects:cnv0

This is an old revision 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

SPECIFICATIONS

*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

cnv0 will take a minimum of 2 and a maximum of 4 arguments. The first will be a quantity of how many numbers to output. The second will be the n-ary value, and the third will be the lower-bound of where to begin checking values, and the fourth will be the upper-bound of where to stop checking values.

OUTPUT SPECIFICATIONS

VERIFICATION

notes/discrete/fall2022/projects/cnv0.1663297007.txt.gz · Last modified: 2022/09/16 02:56 by abarbcal