Skip to content

Commit

Permalink
euler30
Browse files Browse the repository at this point in the history
  • Loading branch information
astro committed Dec 9, 2008
1 parent 2bd6e96 commit a2cec16
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions euler30.hs
Original file line number Diff line number Diff line change
@@ -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.