diff options
Diffstat (limited to 'haskell/p377.hs')
-rw-r--r-- | haskell/p377.hs | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/haskell/p377.hs b/haskell/p377.hs new file mode 100644 index 0000000..f511046 --- /dev/null +++ b/haskell/p377.hs @@ -0,0 +1,12 @@ +import Data.Char + +f :: Int -> Integer +f n = sum [x | x <- [1..10^n], nozero x, sumn x n] + where + nozero x = notElem '0' (show x) + sumn x n = sum (map digitToInt (show x)) == n + +p377 :: String +p377 = reverse . (take 9) . reverse . show $ sum [f 13^i | i <- [1..17]] + +main = putStrLn $ "Solution: " ++ p377 |