Special pythagorean triplet: Difference between revisions

m
→‎{{header|Wren}}: Changed to Wren S/H
No edit summary
m (→‎{{header|Wren}}: Changed to Wren S/H)
 
Line 1,348:
=={{header|Wren}}==
Very simple approach, only takes 0.013 seconds even in Wren.
<syntaxhighlight lang="ecmascriptwren">var a = 3
while (true) {
var b = a + 1
Line 1,373:
<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:
<syntaxhighlight lang="ecmascriptwren">for (a in 3..332) {
var b = a + 1
while (true) {
9,482

edits