Craig,
Well, it all compiles and runs but the results is empty. I have intercepted the reduce function and the supplied list is correct. Meaning all primes are in there. Weird. Dunno what's wrong here.
Did you try defining the job to write the results to file? This will work until I fix the iterator issue.
Yes, I'm using reduce_file_output. But all files are empty. Can you reproduce that? Please make sure to get the latest from my subversion.
A small optimization in the is_prime is to check for %2 - this avoids expensive sqrt & loops for even numbers that are always not prime
bool const is_prime(long const number) { if (number == 0 || number == 1) return false; else if (number == 2) return true; else if (number%2 == 0) return false; ... }
Thanks. ;-) Most important for me right now is to learn how to solve problems with mapreduce. Ideas for some other problems? Christian