indy

My research has generated interest from a funding agency, but I need to verify a few things with my data.

I'm generating numbers which measure the amount of DNA strands in a typical rabbit's foot - I'm trying to determine if a rabbit's foot really IS lucky. I presently have files containing millions of pieces of data. Each data point is stored in a file as a 32 bit integer.

To complete my research. We (you!) need to:
  1. Find how many data points there are, the range and the average.
  2. Find the primality of each number and the percentage of the total that are prime & store each prime in an array for further processing.
  3. Find how many primes are palindromic.
  4. Sort the prime array, small to large.
  5. (Someday) Report the longest sequence of uninterrupted primes.

I'm not overly concerned with efficiency at this point - I just need those numbers. But we may need to do other investigations later, so write the code so that it can be modified easily.

We only have a C++ compiler and it's located on the computer called cisprod.clarion.edu. You can telnet to that computer and logon with your Clarion username and password. You can download puTTy and Visual C++ for free.


I have files of various sizes, but ultimately, please work with the last in the list, "biggest.txt". The files can be viewed on the web at http://jupiter.clarion.edu/~wyatt/!Data/. 1. smallest.txt - 20 numbers - all prime - first 20 primes 2. smaller.txt - 80 numbers - first 40 prime followed by first 40 non-prime 3. small.txt - 1,000 numbers random 4. big.txt - 10,000 numbers random 5. bigger.txt - 100,000 numbers random 6. biggest.txt - 1,000,000 numbers random **USE THIS SET for FINAL #s I have the smaller files there in case you need smaller data sets for testing. When your program opens the file, you will access the file as such: ifstream fin; fin.open("/export/home/wyatt/public_html/\!Data/biggest.txt"); Remember to read an integer, num, from the file stream you called "fin" above: See error-proof code to read an int value in C++
Please write the code as follows: 1. Document what and why - other grad students will pick up your work after you move on. Name variables and functions well. Include a brief algorithm as appropriate (example: how does your code determine primality?). 2. Create a function to accomplish each task. Pass parameters as needed. Having a function that can test primality of a number could be useful in the future.
Goals: Learn enough C++ and Unix to function in a lab. Program Structure, Variables, Arithmetic & Logical & Relational Operators, Loops, Branching, Functions, Files, Arrays.
Some helpful links: c++ help cplusplus reference unix reference Prime number lists Big Primes - Lists