
27 Jul
2008
27 Jul
'08
7:53 a.m.
Steve Klabnik wrote:
f :: Int -> Int -> Int f acc x | x == 1 = acc | even x = f (acc + 1) (x `div` 2) | otherwise = f (acc + 1) (3 * x + 1) One more remark: you're using Ints. This type is limited to [-2^31..2^31]. Maybe you should use Integers, or only specify that the in- and output should be numeric, or perhaps even omit the type annotation altogether.
Try running: f 1 113383 (with Int and Integer/no type annotation) Niels