Coprimes: Difference between revisions

Content added Content deleted
(→‎{{header|Raku}}: Add a Raku entry)
Line 35: Line 35:


=={{header|Raku}}==
=={{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).
How do you determine if numbers are co-prime? Check to see if the [[Greatest common divisor]] is equal to one. Since we're duplicating tasks willy-nilly, 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>
<lang perl6>say .raku, ( [gcd] |$_ ) == 1 ?? ' Coprime' !! '' for [21,15],[17,23],[36,12],[18,29],[60,15]</lang>