DEV Community

loading...

Discussion on: Daily Challenge #78 - Number of Proper Fractions with Denominator d

Collapse
swizzard profile image
sam
import GHC.Real (Ratio(..))

isProper n x = let (a :% b) = (x / n) :: Rational
                in if b == n then True else False

properFractions n = length [a / n | a <- [1..n], isProper n a]