module Exercise_6 where import Data.Ratio import Data.List import Data.Maybe --import Debug.Trace traceFractran :: [Rational] -> Integer -> [Integer] {-WETT-} traceFractran fs = unfoldr (\n -> listToMaybe [(n, numerator x) | t <- fs ++ [0%1], let x = n % 1 * t, denominator x == 1, n > 0]) {-TTEW-} isPowerOfTwo :: Integer -> Bool isPowerOfTwo 0 = False isPowerOfTwo 1 = False isPowerOfTwo 2 = True isPowerOfTwo n | even n = isPowerOfTwo (div n 2) | otherwise = False primeprog = [17%91 ,78%85 ,19%51 ,23%38 ,29%33 ,77%29 ,95%23 ,77%19 ,1%17 , 11%13 ,13%11 ,15%14 ,15%2 ,55%1]