Created
August 18, 2013 09:45
-
-
Save reuk/6260802 to your computer and use it in GitHub Desktop.
My first Project Euler solution using Haskell. This one (number 55) finds how many Lychrel numbers are smaller than 10000.
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
solve = isLychrel 0 | |
where isLychrel i x | d == reverse d = False | |
| i > 50 = True | |
| otherwise = isLychrel (i + 1) c | |
where b = reverse $ show x | |
c = (x + (read b :: Integer)) | |
d = show c | |
main = print $ length $ filter (== True) $ map solve [1..9999] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment