Sunday, March 24, 2013

project euler problem 060

Prime pair sets

This might be a relatively difficult problem so far. I checked my old code. It is ugly. I created  prime numbers up to 1e8, which is a huge cost(run time 22s).  I used strong pseduoprime test instead of checking from the prime list, the code run time reduced to 1.4s. But the code structure still looks unacceptable.

 I rewrote my code, following the clever idea found in the discussion thread. The new code looks simpler, but not too much performance gain.

No comments:

Post a Comment