Sunday, March 24, 2013

project euler problem 058

Spiral primes

This problem is about the primality of a number. I used two different method to solve this problem. First, use a prime table and second use strong pseudo prime test. The first method takes 0.1 second and the second takes 0.04 second. 

update 09/17/2017. This problem is great, but the 10% requirement is too easy for everyone to get a correct answer, if this number is reduced to 8%, the problem is a lot more difficult since overflow is a challenging issue for primality test. I found a different approach from Inamori and francky's post, which is brilliant. 

No comments:

Post a Comment