fact' x accumulator = if x < 2 then accumulator else fact' (x - 1) (accumulator * x) fact x = fact' x 1 main = do putStr (show (fact 1000000))