Coprimes: Difference between revisions
Content added Content deleted
Thundergnat (talk | contribs) (→{{header|Raku}}: Add a Raku entry) |
Thundergnat (talk | contribs) m (→{{header|Raku}}: meh) |
||
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. |
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> |