From 9cc718e6b2d0268a5cdd13a7a403bbd1d0c4773c Mon Sep 17 00:00:00 2001 From: Bill Ewanick Date: Wed, 18 Oct 2023 23:25:25 -0400 Subject: [PATCH] Question 16 --- src/projectEuler/question16.hs | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 src/projectEuler/question16.hs diff --git a/src/projectEuler/question16.hs b/src/projectEuler/question16.hs new file mode 100644 index 0000000..b8d97a0 --- /dev/null +++ b/src/projectEuler/question16.hs @@ -0,0 +1,15 @@ +{- +https://projecteuler.net/problem=16 + +2^15 = 32768 and the sum of its digits is 3 + 2 + 7 + 6 + 8 = 26. + +What is the sum of the digits of the number 2^1000? +-} + +module Main where + +main :: IO () +main = print ans + +ans :: Integer +ans = sum $ map (\c -> read [c] :: Integer) $ show (2^1000)