Permalink
Browse files

solved euler 55

  • Loading branch information...
1 parent a9cbb96 commit 3d817a52a3ae705cbde6a3d9eaf345c8f95490e5 @Swizec committed Jan 27, 2012
Showing with 14 additions and 0 deletions.
  1. +14 −0 project-euler/55.hs
View
@@ -0,0 +1,14 @@
+
+reverse' = read . reverse . show
+
+palindrome n = n == reverse' n
+
+-- max denotes max recursion depth
+lychrel n max
+ | max <= 0 = True
+ | palindrome$n+r = False
+ | otherwise = lychrel (n+r) (max-1)
+ where r = reverse' n
+
+lychrels max =
+ length [x | x <- [1..max], lychrel x 50]

0 comments on commit 3d817a5

Please sign in to comment.