From b305c522af95f196f884a28ec917ca4c37ee5756 Mon Sep 17 00:00:00 2001 From: Frank Kair Date: Fri, 21 Feb 2020 21:33:26 +0000 Subject: [PATCH] Feat: Adds Haskell p030 --- src/030/p030.hs | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 src/030/p030.hs diff --git a/src/030/p030.hs b/src/030/p030.hs new file mode 100644 index 0000000..d8aecb8 --- /dev/null +++ b/src/030/p030.hs @@ -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