Saturday, June 1, 2013

project euler problem 196

Prime triplets

This problem is relatively simple. One just needs to find all primes in range [low, high]. The problem is well defined and easy to solve. My code is not so nice. But it runs under 1 second. 

1 comment:

  1. I'm impressed at your getting the time to under a second (on a 2013 computer) -- my solutions take around 2-4 seconds on reasonably modern PCs, and a C++ solution I compared with takes around 2 seconds. I couldn't find any especially "clever" optimizations -- just the typical ones you'd use for a primes problem (pre-calculating primes in a suitable range) and a slight improvement to my original code for finding "neighbour" cells in the triangle grid. Without giving away anything -- did you find better tricks/optimizations than that?

    ReplyDelete