Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- smallestCoPrimeOf :: Int -> Int
- smallestCoPrimeOf a
- = iterateCandidates a startingCandidate
- where
- startingCandidate = 2
- iterateCandidates :: Int -> Int -> Int
- iterateCandidates a candidate
- | gcd a candidate == 1 = candidate
- | otherwise = iterateCandidates a (candidate + 1)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement