Represent a prime number as a sum of four squared integers
问题 Given a prime number p, find a four integers such that p is equal to sum of square of those integers. 1 < p < 10^12. If p is of form 8n + 1 or 8n + 5, then p can be written as sum of two squares. This can be solved in O(sqrt(p)*log(sqrt(p)). But for other cases,i.e. when p cannot be written as sum of two squares, than is very inefficient. So, it would be great if anyone can give some resource material which i can read to solve the problem. 回答1: Given your constraints, I think that you can do