Saturday, March 30, 2013

project euler problem 077

Prime summations

Similar to problem 76. 

This is not a difficult problem. But there is a lot  math to be learned in the discussion thread. Euler is really a genius!

Update 09/25/2017: 
The recursive method used in my previous code is too slow. I did not notice that until I tried to find the number of ways to express 1000 in primes. It is too slow! I used the dynamic programming approach to solve  this knapsack problem and it takes less than 1ms to get the result!

No comments:

Post a Comment