import Data.Char (ord) initialValue :: String -> Int initialValue = sum . map ord syracuse :: Integer -> Integer syracuse x = if(even x) then x `div` 2 else x * 3 + 1 suite :: Integer -> [Integer] suite = (++ [1]) . takeWhile (/=1) . iterate syracuse tempsVol = length tempsVolAltitude s@(x:xs) = (length . (takeWhile (>=x))) s tempsVolAltitude [] = 0 altitudeMax = maximum getData v = let iv = initialValue v s = suite $ toInteger iv tv = tempsVol s tva = tempsVolAltitude s am = altitudeMax s in (s, tv, tva, am) main = interact (unlines . (map (show . getData)) . lines)