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 Linux:
It has to print the first N abundant numbers to STDOUT, one number per line. Example:
$ ./abundant 5 12 18 20 24 30
You can assume that the value N is a positive integer at most 1000000.
The performance does not matter; a slow but correct solution is sufficient.
Your program can use any functions in the C or C++ standard library, but no other libraries. It has to be written 100% by yourself. You cannot work together with other students, or use any code that you find online.
Your program should compile fine with GCC version 4.8 or 4.9. For example, if you have written a C++ program using C++11, I would expect that the following command on the classroom Linux computers will compile your program successfully:
g++-4.9 -std=c++11 -Wall -Wextra -O3 abundant.cc -o abundant
Your solution should be a single C or C++ file, named
abundant.cc. Email your solution to the teaching assistant as instructed here.