Coprimes: Difference between revisions
→{{header|Raku}}: Add a Raku entry
(Added Go) |
Thundergnat (talk | contribs) (→{{header|Raku}}: Add a Raku entry) |
||
Line 33:
[18 29]
</pre>
=={{header|Raku}}==
How do you determine if numbers are co-prime? Check to see if the [[Greatest common divisor]] is equal to one. So just lift code from [[Greatest_common_divisor#Raku|that task]], (or in this case, just use the builtin).
<lang perl6>say .raku, ( [gcd] |$_ ) == 1 ?? ' Coprime' !! '' for [21,15],[17,23],[36,12],[18,29],[60,15]</lang>
<pre>[21, 15]
[17, 23] Coprime
[36, 12]
[18, 29] Coprime
[60, 15]</pre>
=={{header|Ring}}==
|