Welcome to the Monastery PerlMonks

### Re^2: pythagorean triples

by thor (Priest)
 on Apr 24, 2006 at 03:50 UTC ( #545192=note: print w/replies, xml ) Need Help??

in reply to Re: pythagorean triples
in thread pythagorean triples

That's correct, but any integer multiple of a primitive Pythagorean triple is also a Pythagorean triple. (The proof is left as an exercise for the reader) This sequence generates the set of primitive Pythagorean triples (assuming that \$m & \$n are coprime)

thor

The only easy day was yesterday

Replies are listed 'Best First'.
Re^3: pythagorean triples
by chas (Priest) on Apr 24, 2006 at 04:36 UTC
Well, it's true that the primitive triples are of that form, but not conversely; 6,8,10 occurs for n=3,m=1 (which are coprime), and that triple isn't primitive. So the code generates primitive (i.e. having no common factor) triples, but some others as well. The real point is that it isn't so easy to print a list of all Pythagorean triples without duplication, and I guess that thought was what motivated my reply.

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

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (12)
As of 2018-04-26 18:23 GMT
Sections?
Information?
Find Nodes?
Leftovers?
Voting Booth?
My travels bear the most uncanny semblance to ...

Results (97 votes). Check out past polls.

Notices?