Created
August 27, 2012 03:01
-
-
Save 2GMon/3485208 to your computer and use it in GitHub Desktop.
Project Euler : Problem 36
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
-- Project Euler : Problem 36 | |
binary :: Integer -> String | |
binary 0 = "0" | |
binary 1 = "1" | |
binary n = (binary $ fst div) ++ (show $ snd div) | |
where div = n `divMod` 2 | |
main = print $ sum [a | a <- [1..999999], | |
(show a) == (reverse $ show a), | |
(binary a) == (reverse $ binary a) | |
] | |
-- 872187 | |
-- ./dailycoding36 0.38s user 0.00s system 99% cpu 0.383 total |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment