module Exercise_6 where import Data.List import Data.Ratio {-WETT-} traceFractran :: [Rational] -> Integer -> [Integer] traceFractran rs n | Just ff <- tmp = n : traceFractran rs (numerator ff) | otherwise = [n] where tmp = find ((== 1) . denominator) $ map (* (n % 1)) rs {-TTEW-} isPowerOfTwo 1 = True isPowerOfTwo x | x `mod` 2 == 0 = isPowerOfTwo (x `div` 2) | otherwise = False