Programming Parallel Computers 2019

Prerequisite test

Please first use Oodi to register for the course. Then make sure you have a GitHub user account — if not, create an account at github.com first.

Then you are ready to solve the following prerequisite test, which basically checks that you know how to write a C++ program and compile and run it on a Linux computer.

Abundant numbers

Write a program that prints the first N abundant numbers. The program has to be a command-line tool that you can run as follows on the classroom Linux computers:

./abundant N

It has to print the first N abundant numbers to STDOUT, one number per line (and nothing else!), and then exit successfully. You can assume that the value N is a positive integer at most 1000000.

Details

Your program has to be written in standard C++, using the standard version C++11. Your program can use all functions in the C++ standard library (including all functions in the C standard library), but no other libraries. It is fine to use plain C, as long as your program compiles fine with a C++ compiler. Your program has to be written 100% by yourself. You cannot work together with other students, or use any code that you find online.

Your solution has to be a single C++ file, named abundant.cc, and it has to compile fine with GCC version 5.4, which is installed in the classroom computers. Test your code on the classroom computers and make sure the following command compiles it successfully:

g++ -std=c++11 -Wall -Wextra -O3 abundant.cc -o abundant

Then make sure it works correctly (here “$” represents the Linux command prompt); here are some examples:

$ ./abundant 1
12
$ ./abundant 2
12
18
$ ./abundant 5
12
18
20
24
30
$ ./abundant 10000 | tail -1
40350
$ ./abundant 5 | md5sum
f85c2aa82cd806cb71bcec038fe5a4c5  -
$ ./abundant 10000 | md5sum
9063302ee3b8bb6ab5d3a4cbf64c17f7  -

The performance does not matter; a slow but correct solution is sufficient (as long as it is not ridiculously inefficient).

Submitting your solution

You will submit your solution online in A+ system. Log on to A+, enroll there for the course CS-E4580, and you should find the prerequisite test there. The test opens on 8 April 2019, and closes on 19 April 2019, at noon.

The system will ask you to enter the following information:

The system will automatically verify your submission. If all goes well, you can just wait and relax.

In a few days, you should receive an invitation by email from GitHub to join the course organization — we will announce in our Slack chat whenever we process prerequisite test submissions and send out GitHub invitations.

After that, please read the instructions on the course workflow to get started with the course work.

Questions?

Please use the channel #prereq in our Slack chat if you need any help with the prerequisite test.