Digital root sums of factorisations
An excellent problem. I like it. Although it is easy to get the correct answer, but it is not that simple to solve it in 50 ms.
I checked my old code. I used pure brute force. It takes 3 seconds. I did some optimization and reduced to 0.5 second.
Then I read the discussion thread. I found the post from Robert_Gerbicz, a legendary figure in Project Euler forum. I tried his method. Oh, my god, he made it in 40ms. I read his post, it is really amazing!
No comments:
Post a Comment