No such thing as a small change PerlMonks

### Re^2: Triangle Numbers Revisited

by tmoertel (Chaplain)
 on Oct 15, 2004 at 19:09 UTC ( #399619=note: print w/replies, xml ) Need Help??

in reply to Re: Triangle Numbers Revisited

Quick question regarding screening out "a few factors which would make a solution impossible": Didn't Gauss prove Fermat's polygonal theorem for triangle numbers, showing that every positive integer can be represented as a sum of at most three triangle numbers? If so, how can there be cases for which a solution is impossible? (Or are you saying that the method you're using only works for some cases?)

Replies are listed 'Best First'.
Re^3: Triangle Numbers Revisited
by tall_man (Parson) on Oct 15, 2004 at 19:30 UTC
I'm talking about an intermediate step. I'm looking for three odd squares that add to the number 8*M+3. I pick the first number, k, by brute force working down from the square root. So then I have to solve:
```  N = 8*M + 3 - k^2
i^2 + j^2 = N
There are choices for k that don't work. I want to eliminate them quickly and move on to the next k in the loop instead of spending time trying all combinations of i and j. Eventually I will find an answer, but that choice of k won't be part of it.

For example, if N is a multiple of an odd power of 3, the quadratic problem can't be solved in integers. So I can eliminate about 1/3 of the possible choices for k.

Re^3: Triangle Numbers Revisited
by tilly (Archbishop) on Oct 15, 2004 at 19:44 UTC
I hadn't known it, but you're right, Gauss proved that in his diary (which wasn't discovered until he had been dead 50 years).

Create A New User
Node Status?
node history
Node Type: note [id://399619]
help
Chatterbox?
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (9)
As of 2018-06-20 20:28 GMT
Sections?
Information?
Find Nodes?
Leftovers?
Voting Booth?
Should cpanminus be part of the standard Perl release?

Results (117 votes). Check out past polls.

Notices?