Created
March 30, 2015 04:17
-
-
Save takahisa/c81ff0263546e907bc56 to your computer and use it in GitHub Desktop.
Hamming
This file contains hidden or 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
hamming :: [Int] | |
hamming = filter p [1..] | |
where | |
p :: Int -> Bool | |
p x | x `mod` 5 == 0 = p (x `div` 5) | |
| x `mod` 3 == 0 = p (x `div` 3) | |
| x `mod` 2 == 0 = p (x `div` 2) | |
| otherwise = x == 1 | |
main :: IO () | |
main = mapM_ print (take 30 hamming) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment