Coprime triplets: Difference between revisions

m
(→‎{{header|Quackery}}: shortened code)
m (→‎{{header|Wren}}: Minor tidy)
 
(2 intermediate revisions by one other user not shown)
Line 1,091:
Found 36 coprime triplets
done...
</pre>
 
=={{header|RPL}}==
{{works with|HP|49g}}
≪ {2 1} → coprimes
≪ '''WHILE''' coprimes HEAD 50 < '''REPEAT'''
coprimes 1 2 SUB
1
'''DO'''
'''DO''' 1 +
'''UNTIL''' coprimes OVER POS NOT '''END'''
'''UNTIL''' DUP2 GCD {1 1} == '''END'''
'coprimes' STO+ DROP
'''END'''
coprimes TAIL REVLIST
≫ ≫ ‘<span style="color:blue">TASK</span>’ STO
{{out}}
<pre>
1: {1 2 3 5 4 7 9 8 11 13 6 17 19 10 21 23 16 15 29 14 25 27 22 31 35 12 37 41 18 43 47 20 33 49 26 45}
</pre>
 
Line 1,186 ⟶ 1,205:
{{trans|Phix}}
{{libheader|Wren-math}}
{{libheader|Wren-seq}}
{{libheader|Wren-fmt}}
<syntaxhighlight lang="ecmascriptwren">import "./math" for Int
import "./seqfmt" for LstFmt
import "/fmt" for Fmt
 
var limit = 50
Line 1,204 ⟶ 1,221:
}
System.print("Coprime triplets under %(limit):")
for (chunk in Lst.chunks(cpt, 10)) Fmt.printtprint("$2d", chunkcpt, 10)
System.print("\nFound %(cpt.count) such numbers.")</syntaxhighlight>
 
9,476

edits