This program runs faster than HW5 because I mod the primes less than squareroot of k (k is the number we are checking), using the primes theories.

This program read an integer number and a filename "File", and the output is written to "File" with the primes in an increasing order, I also print out the value of n and the elapsed time.

The graph is not so good but we still can see that the general trend is: when the number of primes increases, the elapsed time also increases. 
 


  

sample resluts:
[meifangz@galois6 ~/Meifang_HW_6]$ ./Meifang_HW_6 
Input an integer number n
10000
Using 0.00 sec. 
Input the filename for result:
out
[meifangz@galois6 ~/Meifang_HW_6]$ ./Meifang_HW_6 
Input an integer number n
100000
Using 0.00 sec. 
Input the filename for result:
out
[meifangz@galois6 ~/Meifang_HW_6]$ ./Meifang_HW_6 
Input an integer number n
1000000
Using 8.00 sec. 
Input the filename for result:
out