Skip to content

Commit

Permalink
Feat: Adds Haskell p030
Browse files Browse the repository at this point in the history
  • Loading branch information
FrankKair committed Feb 21, 2020
1 parent 5c5421f commit b305c52
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/030/p030.hs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import Data.Digits

digitsFifthPower :: Integer -> Integer
digitsFifthPower n =
sum $ map (\x -> x ^ 5) $ digits 10 n

solve :: Integer
solve =
sum $ filter (\x -> digitsFifthPower x == x) $ takeWhile (< 200000) [1..]

main :: IO ()
main =
print $ solve

0 comments on commit b305c52

Please sign in to comment.