Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

euler30

  • Loading branch information...
commit a2cec16130c7efa60ef87488e569b7a056c7a2e7 1 parent 2bd6e96
@astro authored
Showing with 14 additions and 0 deletions.
  1. +14 −0 euler30.hs
View
14 euler30.hs
@@ -0,0 +1,14 @@
+import Data.Char (ord)
+
+hoch n 0 = 1
+hoch n m = n * (n `hoch` (m - 1))
+
+digits n = map (\c -> (ord c) - (ord '0')) $ show n
+
+euler30' n = n == n_sum
+ where n_sum = sum n_sqs
+ n_sqs = map (\m -> m `hoch` 5) d
+ d = digits n
+
+euler30 = (numbers, sum numbers)
+ where numbers = filter euler30' [2..(5 * (9 `hoch` 5))]

0 comments on commit a2cec16

Please sign in to comment.
Something went wrong with that request. Please try again.