nextCollatz n | even n = div n 2 | otherwise = n * 3 + 1 collatzCount c n | n == 1 = c | otherwise = collatzCount (c + 1) (nextCollatz n) lengths = map (collatzCount 0) [1..30] main = putStrLn $ show lengths