I was going through Erich Friedman's "What's Special About This Number?" and there some numbers are classified based on the number of ways we can write them as sum of squares. I want to prove the following claim by Friedman:
129 is the smallest number that can be written as the sum of 3 squares in 4 ways.
Indeed, as given in Wikipedia, $$11^2+2^2+2^2 = 10^2+5^2+2^2 = 8^2+8^2+1^2 = 8^2+7^2+4^2 = 129$$ So what remains to prove is that this is the smallest such number.
Is it possible to write a proof for this fact using some insights along with brute force/cases? How can we solve this problem using only brute-force?
Also, since I know the proof of Legendre's three-square theorem. I am also curious to know:
How can we determine the number of ways we can write a non-negative integer which satisfies Legendre's three-square theorem as sum of three squares?
Edit1: Related discussions on MathOverflow:
- Is there a simple way to compute the number of ways to write a positive integer as the sum of three squares?: Note that this is not answer of my question since $r_k(n)$ counts the number of representations of $n$ by $k$ squares, allowing zeros and distinguishing signs and order.
- Efficient computation of integer representation as sum of three squares
Edit2: Related discussions on ComputerScience.SE
Edit3: Related discussions on Mathematics.SE