Express Integer as the sum of $k$ squares

88 Views Asked by At

I'm looking for a way to efficiently determine the solutions ( i.e. sets of $x_1^2, x_2^2, ..., x_k^2 $ ) that satisfy     $$n^2 = x_1^2 + x_2^2 + x_3^2 + ... + x_k^2 $$ $$x_1, x_2, ..., x_k, n, k \in\mathbb{Z}_{>0}$$