How can we represent, say, 123456 as a sum of four squares? Can it be done in more than one way, perhaps?

Yes, it can be done in exactly 181 ways. Three examples are:

$123456 = 0^2+8^2+176^2+304^2$

$123456 =28^2+172^2+172^2+252^2$

$123456 =4^2+12^2+236^2+260^2$

Representations like this can be calculated with Mathematica, use the PowersRepresentations function.

Calculations like this are expensive, i.e. can take a long time. Could be interesting to have study the algorithm.

Sofar, I read the proof of Lagrange's four-square theorem in three books. ( As a preparation for the general proof of the polygonal number theorem by Cauchy. ) Although they all (i.e. Nathanson, Burton and Davenport, ) use the same proof the clarity differs greatly among these authors. At a certain level too much verbosity doesn't add to the clarity anymore but nothing is worse than too much density. Only Davenport used an example to illustrate the proof, thanks to his text I am beginning to understand the proof.

13-2016 Open letter to Open Source for You (OSFY)

4 months ago