Thursday, March 28, 2013

project euler problem 072

Counting fractions

I checked my old code. I was trying to factor each number n, then find the number of relative prime numbers to n. This time I directly calculate the totient function for each number, using sieve. 

It takes 3.6s to finish for the old code, while 0.076s for the new code.

No comments:

Post a Comment