99-haskell-problems/Problems 31-41/problem_33.hs

11 lines
217 B
Haskell
Raw Normal View History

2024-05-26 01:13:00 -05:00
myGCD :: (Integral n) => n -> n -> n
myGCD m n =
if remainder == 0
then abs n
else myGCD n remainder
where
remainder = m `mod` n
coprime :: (Integral n) => n -> n -> Bool
coprime m n = myGCD m n == 1