Created
September 24, 2015 11:06
-
-
Save motokiee/1a45d6a115b91a721410 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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