Table of Contents

Corning Community College

CSCS2330 Discrete Structures

Project: EXPLORING WEIRD NUMBERS (ewn0)

Objective

To apply your skills in implementing an algorithm that determines certain attributes of a number based on its factor composition.

Background: Numerology

In ancient times, numbers and properties of numbers carried certain mystical qualities. In the Pythagorean tradition (at least as history attributes it), we have the following classifications:

There are two activities at play here:

  1. the knowledge of the factors of a number (which we've had some experience with in our prime number endeavors)
  2. the sum of those factors to make the above determination of attribute

We will be writing a program that will perform these actions for a range of numbers.

Program: Description and Specifications

You are to write a program that:

Grabit Integration

For those familiar with the grabit tool on lab46, I have made some skeleton files and a custom Makefile available for this project.

To “grab” it:

lab46:~/src/discrete$ grabit discrete ewn0
make: Entering directory '/var/public/SEMESTER/CLASS/ewn0'

‘/var/public/SEMESTER/CLASS/ewn0/Makefile’ -> ‘/home/USERNAME/src/CLASS/ewn0/Makefile’
‘/var/public/SEMESTER/CLASS/ewn0/ewn0.c’ -> ‘/home/USERNAME/src/CLASS/ewn0/ewn0.c’

make: Leaving directory '/var/public/SEMESTER/CLASS/ewn0'
lab46:~/src/discrete$ cd ewn0
lab46:~/src/discrete/ewn0$ ls
Makefile          ewn0.c
lab46:~/src/discrete/ewn0$ 

Just another “nice thing” we deserve.

NOTE: You do NOT want to do this on a populated ewn0 project directory– it will overwrite files. Only do this on an empty directory.

Makefile fun

With the Makefile, we have your basic compile and clean-up operations:

Execution

Your program output should be as follows (given the specific inputs via the command-line):

lab46:~/src/discrete/ewn0$ ./ewn0 2 16
[2] deficient: 1 = 1
[3] deficient: 1 = 1
[4] deficient: 1+2 = 3
[5] deficient: 1 = 1
[6] perfect:   1+2+3 = 6
[7] deficient: 1 = 1
[8] deficient: 1+2+4 = 7
[9] deficient: 1+3 = 4
[10] deficient: 1+2+5 = 8
[11] deficient: 1 = 1
[12] abundant:  1+2+3+4+6 = 16
[13] deficient: 1 = 1
[14] deficient: 1+2+7 = 10
[15] deficient: 1+3+5 = 9
[16] deficient: 1+2+4+8 = 15
lab46:~/src/discrete/ewn0$ 

And we don't have to start at 2:

lab46:~/src/discrete/ewn0$ ./ewn0 37 42
[37] deficient: 1 = 1
[38] deficient: 1+2+19 = 22
[39] deficient: 1+3+13 = 17
[40] abundant:  1+2+4+5+8+10+20 = 50
[41] deficient: 1 = 1
[42] abundant:  1+2+3+6+7+14+21 = 54
lab46:~/src/discrete/ewn0$ 

Additionally, we can also do this:

lab46:~/src/discrete/ewn0$ ./ewn0 30 17
[30] abundant:  1+2+3+5+6+10+15 = 42
[29] deficient: 1 = 1
[28] perfect:   1+2+4+7+14 = 28
[27] deficient: 1+3+9 = 13
[26] deficient: 1+2+13 = 16
[25] deficient: 1+5 = 6
[24] abundant:  1+2+3+4+6+8+12 = 36
[23] deficient: 1 = 1
[22] deficient: 1+2+11 = 14
[21] deficient: 1+3+7 = 11
[20] abundant:  1+2+4+5+10 = 22
[19] deficient: 1 = 1
[18] abundant:  1+2+3+6+9 = 21
[17] deficient: 1 = 1
lab46:~/src/discrete/ewn0$ 

Submission

Project Submission

To submit this program to me using the submit tool, run the following command at your lab46 prompt:

lab46:~/src/discrete/ewn0$ make submit
removed 'ewn0'

Project backup process commencing

Taking snapshot of current project (ewn0)      ... OK
Compressing snapshot of ewn0 project archive   ... OK
Setting secure permissions on ewn0 archive     ... OK

Project backup process complete

Submitting discrete project "ewn0":
    -> ../ewn0-DATESTRING-HOUR.tar.gz(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.