Re: Re:need help

*To*: mathgroup at smc.vnet.net*Subject*: [mg87413] Re: [mg87352] Re:[mg87308] need help*From*: Andrzej Kozlowski <akoz at mimuw.edu.pl>*Date*: Thu, 10 Apr 2008 02:11:04 -0400 (EDT)*References*: <200804080938.FAA12123@smc.vnet.net>

On 8 Apr 2008, at 18:38, Patrick Klitzke wrote: > But the problem is, that for some numbers you need more than 4 > squares: > 96=9^2+3^2+2^2+1^2+1^2 A very famous theorem of Lagrange says that every positive integer is a sum of at most 4 squares. This result can be found in virtually every book on number theory (e.g. see K. Chandrasekharan, "Introduction to Analytic number theory"). In the case of 96 we have PowersRepresentations[96, 4, 2] {{0, 4, 4, 8}} in other words 96 = 0^2+4^2+4^2+8^2 so in fact you only need 3 squares. Of course if you allow more squares you will get more representations: PowersRepresentations[96, 5, 2] {{0, 0, 4, 4, 8}, {1, 1, 2, 3, 9}, {1, 1, 3, 6, 7}, {1, 3, 5, 5, 6}, {2, 2, 4, 6, 6}, {2, 3, 3, 5, 7}} Also, the question of finding just one representation without restriction on length is trivial since you can represent any number as a sum of squares of 1's ! Andrzej Kozlowski

**References**:**Re:need help***From:*Patrick Klitzke <philologos14@gmx.de>