Possible Duplicate:
Need help solving Project Euler problem 200
Similar to this question
I wrote up a brute force solution in Java that takes several hours to run, and produced the first 500+ sqube numbers, which I thought should be enough. However, none of the answers from 190 to 210 seems to be the correct answer.
I'm wondering what I'm doing wrong here and how I could optimize this. Could the problem lie in BigInteger.isProbablePrime()
?
I'm not sure if Stackoverflow is the best place to ask this, but I seem to be stuck. I've included my code and the generated data.
I'd really appreciate it if someone would give me some hints or pointers.
Edit: I've run the program again simply with using the first 500,000 prime numbers; took a day to run but produced the correct answer.