Special pythagorean triplet: Difference between revisions

Added 11l
(Added 11l)
Line 6:
* [[Pythagorean triples]]
<br><br>
=={{header|11l}}==
<lang 11l>V PERIMETER = 1000
L(a) 1 .. PERIMETER
L(b) a + 1 .. PERIMETER
V c = PERIMETER - a - b
I a * a + b * b == c * c
print((a, b, c))</lang>
 
{{out}}
<pre>
(200, 375, 425)
</pre>
 
=={{header|ALGOL 68}}==
Uses Euclid's formula, as in the XPL0 sample but also uses the fact that M and N must be factors of half the triangle's perimeter to reduce the number of candidate M's to check. A loop is not needed to find N once a candidate M has been found.
1,480

edits