Odd period square roots
This problem is interesting in the early problems. My method is not elegant and I learned a little bit math in the discussion thread which I have no idea how to prove it. My method ran in 0.1 second and my new version only take 0.02 second.
The old day's project Euler problem are quite friendly. For example, This
problem only asks find the numbers less than 10,000. If this problem is posted in 2013, I guess it might be 1,000,000 or even larger.
I tested my code, if the number changed to 1,000,000. My old version takes 29.6s while new version takes 7s. Not too bad.
No comments:
Post a Comment