Improved project structure.
This commit is contained in:
8
haskell/e014.hs
Normal file
8
haskell/e014.hs
Normal file
@@ -0,0 +1,8 @@
|
||||
collatz :: Integral a => a -> [a]
|
||||
collatz 1 = 1:[]
|
||||
collatz x
|
||||
| even x = x:collatz (quot x 2)
|
||||
| odd x = x:collatz (3*x + 1)
|
||||
|
||||
main = do
|
||||
putStrLn . show $ maximum $ zip (map (length . collatz) [1..1000000]) [1..]
|
||||
Reference in New Issue
Block a user