Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re^2: pythagorean triples

by jgamble (Pilgrim)
on Apr 24, 2006 at 21:21 UTC ( #545395=note: print w/replies, xml ) Need Help??


in reply to Re: pythagorean triples
in thread pythagorean triples

True, but it's fairly easy to filter out the non-primitives.

If m and n are both even, skip (a, b, and c will all be divisible by two).

If m and n are both odd, skip (a, b, and c will all be divisible by two).

If m and n have a divisor in common (e.g., GCD{12,3} != 1) skip (a, b, and c will have that factor in common).

The first case can be wrapped up in third case (actually, it can be wrapped up in the second case too), but I find that it makes things clearer to separate them out.

Replies are listed 'Best First'.
Re^3: pythagorean triples
by jgamble (Pilgrim) on Apr 25, 2006 at 04:23 UTC

    The third case should of course have been written as:

    If m and n have a divisor in common (e.g., GCD{m,n} != 1) skip (a, b, and c will have that divisor in common).

    Sorry about that

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://545395]
help
Chatterbox?
[atcroft]: Lady_Aleena: I considered it a violation of the principle of least surprise, but before I tried sending a message to the particular author (and perhaps make myself appear more foolish than normal), I wanted to find out if there was a more site-agnostic
[atcroft]: way (since I am guessing that MetaCPAN may be the author's preferred CPAN interface).

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (5)
As of 2017-05-27 04:00 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?