Skip to content

Instantly share code, notes, and snippets.

@motokiee
Created September 24, 2015 11:06
Show Gist options
  • Save motokiee/1a45d6a115b91a721410 to your computer and use it in GitHub Desktop.
Save motokiee/1a45d6a115b91a721410 to your computer and use it in GitHub Desktop.
chain :: Integer -> [Integer]
chain 1 = [1]
chain n
| even n = n : chain (n `div` 2)
| odd n = n : chain (n * 3 + 1)
numLongList :: Int
numLongList = length (filter isLong (map chain [1..1000]))
where isLong xs = length xs > 15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment