Special pythagorean triplet: Difference between revisions
Content deleted Content added
→{{header|Wren}}: Added a further version. |
m →{{header|Wren}}: Added syntax highlighting to second version. |
||
Line 132: | Line 132: | ||
<br> |
<br> |
||
Incidentally, even though we are '''told''' there is only one solution, it is almost as quick to verify this by observing that, since a < b < c, the maximum value of a must be such that 3a + 2 = 1000 or max(a) = 332. The following version ran in 0.015 seconds and, of course, produced the same output: |
Incidentally, even though we are '''told''' there is only one solution, it is almost as quick to verify this by observing that, since a < b < c, the maximum value of a must be such that 3a + 2 = 1000 or max(a) = 332. The following version ran in 0.015 seconds and, of course, produced the same output: |
||
<lang |
<lang ecmascript>for (a in 3..332) { |
||
var b = a + 1 |
var b = a + 1 |
||
while (true) { |
while (true) { |