#!/usr/bin/env stack {- stack script --resolver lts-13.24 --install-ghc --package arithmoi -} {- Consider the fraction, n/d, where n and d are positive integers. If n [Int] reducedProper d = do let pf = map fst $ factorise d x <- [1..d] guard (some (\p -> x `rem` p == 0) pf) return x main :: IO () main = do print $ reducedProper 8