Four Representations using Squares
This problem is very difficult if one can fully understand the math behind the problem and solve it in a mathematical way. But If we do not mind to solve it in an easier way, it is kind of straight forward and the code is easy to write. We have used this method to find primes, factors of numbers, etc....
I tried to reduce the memory usage and break the whole range into a lot of small segments. The memory usage is reduced and the problem is solved in much less time! I used 11.8 seconds to get the answer.
Although I still need to understand more about the math behind the problem, I still learned some math about Jacobi symbol! The property of Jacobi symbol is really amazing!
No comments:
Post a Comment