Coprime triplets: Difference between revisions
m
→{{header|Wren}}: Minor tidy
(→{{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-fmt}}
<syntaxhighlight lang="
import "./
var limit = 50
Line 1,204 ⟶ 1,221:
}
System.print("Coprime triplets under %(limit):")
System.print("\nFound %(cpt.count) such numbers.")</syntaxhighlight>
|