Talk:Pythagorean triples: Difference between revisions

From Rosetta Code
Content added Content deleted
(→‎For reference: 10K in the works)
Line 21: Line 21:
:I got 325 for 1000 using Java. Here's the full list: http://pastebin.com/HK74uBCz --[[User:Mwn3d|Mwn3d]] 00:49, 29 June 2011 (UTC)
:I got 325 for 1000 using Java. Here's the full list: http://pastebin.com/HK74uBCz --[[User:Mwn3d|Mwn3d]] 00:49, 29 June 2011 (UTC)
::Good, beat me to it. I was wondering if I should post the list here, guess not :) --[[User:Ledrug|Ledrug]] 00:52, 29 June 2011 (UTC)
::Good, beat me to it. I was wondering if I should post the list here, guess not :) --[[User:Ledrug|Ledrug]] 00:52, 29 June 2011 (UTC)
:::I'm running 10K now. Even if it finishes before I get bored I don't think I'll put up the full list. It seems like too much. I'll add the count here in any case. --[[User:Mwn3d|Mwn3d]] 00:54, 29 June 2011 (UTC)

Revision as of 00:54, 29 June 2011

Confirmation of coprime

So perimeter is really easy. Coprime isn't something that people outside of math talk about much. I had to look it up on Wikipedia to figure it out, but I'm still not quite sure. It's defined nicely there for two numbers, but we are dealing with three here. Are a, b, and c coprime if gcd(a, b) = gcd(b, c) = gcd(a, c) = 1? Do I need the third gcd evaluation? --Mwn3d 15:28, 28 June 2011 (UTC)

Since a^2 + b^2 == c^2, if any two of them are coprime, the third is also coprime to both, so there's no difference how you interpret "coprime" in this situation. --Ledrug 15:50, 28 June 2011 (UTC)
I see what you did there. So, in general, you need all three gcd's, but in this case (because of the relationship between a, b, and c) you only need two. --Mwn3d 16:16, 28 June 2011 (UTC)
Slight correction: you only need one. --Ledrug 16:18, 28 June 2011 (UTC)

For reference

The correct results:<lang> 10 0 0

         100 17 7
       1,000 325 70
      10,000 4858 703
     100,000 64741 7026
   1,000,000 808950 70229
  10,000,000 9706567 702309
 100,000,000 113236940 7023027

1,000,000,000 1294080089 70230484 </lang> --Ledrug 18:27, 28 June 2011 (UTC)

Hmmm... I get 324 and 4857 for perimeters of 1000 and 10000 respectively. I see that the Python solution also gets 324 for a perimeter of 1000. Am I missing something?--Tikkanz 23:59, 28 June 2011 (UTC)

I got 325 for 1000 using Java. Here's the full list: http://pastebin.com/HK74uBCz --Mwn3d 00:49, 29 June 2011 (UTC)
Good, beat me to it. I was wondering if I should post the list here, guess not :) --Ledrug 00:52, 29 June 2011 (UTC)
I'm running 10K now. Even if it finishes before I get bored I don't think I'll put up the full list. It seems like too much. I'll add the count here in any case. --Mwn3d 00:54, 29 June 2011 (UTC)