module Exercise_6 where import Data.Ratio import Data.List {-WETT-} traceFractran :: [Rational] -> Integer -> [Integer] traceFractran f n = case (find (\x -> numerator x * n `mod` denominator x == 0) f) of Just fract -> n:(traceFractran f (numerator fract * n `div` denominator fract)) Nothing -> [n] {-TTEW-}