Talk:Pythagorean triples: Difference between revisions

m
Line 30:
 
The J code speed sounds pretty good, now only if I can tell what the hell is going on in that code... care to explain, Rdm? --[[User:Ledrug|Ledrug]] 03:55, 29 June 2011 (UTC)
:Ok... I'm using [[wp:Pythagorean_triple#Generating_a_triple|Euclid's formula]] and generating primitive triples. In other words, for all positive integers m and n where <math>m < \sqrt perimeter</math> and m > n and m+n is odd, I find the triple a,b,c = ((m^2)-(n-^2)),(2*m*n),((m^2)+(n^2)), and discard those where the sum is greater than the perimeter. I'm also sorting the result. I'm also going through some extra wasted motion (for example, I am currently discarding duplicates though I can't find any cases where that is necessary). --[[User:Rdm|Rdm]] 10:52, 29 June 2011 (UTC)
6,951

edits