Wednesday, August 14, 2013

project euler problem 268

Counting numbers with at least four distinct prime factors less than 100

A great problem.  

I checked my old code. It runs very slow, near 40 seconds. The worst thing is that I do not know how to speed it up. I checked the discussion and found that it is still about principle of inclusion-exclusion, but our job is to remove the over-count. I wrote some new code and it only takes 0.15 second to get the answer.

No comments:

Post a Comment