import Data.Ratio import Numeric (floatToDigits) fracs :: [Rational] fracs = [ 17 % 91, 78 % 85, 19 % 51, 23 % 38, 29 % 33, 77 % 29, 95 % 23, 77 % 19, 1 % 17, 11 % 13, 13 % 11, 15 % 2, 1 % 7, 55 % 1] start :: Integer start = 2 isInt :: Rational -> Bool isInt n = denominator n == 1 foo :: [Rational] -- fractions (ie, program) -> Integer -- seed integer (ie, pc) -> [Integer] foo fs s = let mfn = (\f -> let v = (s%1) * f in (isInt v, v)) in let bs = map mfn fs in let bb = filter fst bs in if null bb then [s] else let nxt = numerator $ snd $ head bb in s : foo fs nxt -- ghci> take 15 $ foo fracs 2 -- [2,15,825,725,1925,2275,425,390,330,290,770,910,170,156,132]