Jump to content

Coprimes: Difference between revisions

→‎{{header|Haskell}}: Added a definition and example in Haskell
m (→‎{{header|Python}}: Added a solution using Python)
(→‎{{header|Haskell}}: Added a definition and example in Haskell)
Line 164:
[18 29]
</pre>
 
=={{header|Haskell}}==
<lang haskell>------------------------- COPRIMES -----------------------
 
coprime :: Integral a => a -> a -> Bool
coprime a b = 1 == gcd a b
 
 
--------------------------- TEST -------------------------
main :: IO ()
main =
print $
filter
((1 ==) . uncurry gcd)
[ (21, 15),
(17, 23),
(36, 12),
(18, 29),
(60, 15)
]</lang>
{{Out}}
<pre>[(17,23),(18,29)]</pre>
 
 
=={{header|Julia}}==
9,659

edits

Cookies help us deliver our services. By using our services, you agree to our use of cookies.