2008-04-25 Problem16 Project Euler 2^15 = 32768 であり、これの各数字の合計は 3 + 2 + 7 + 6 + 8 = 26 となる。同様にして、2^1000 の各数字の合計を求めよ。 Haskell main=print $ sumdigit $ 2^1000 sumdigit a |a<10 = a |otherwise = mod a 10 +(sumdigit $ div a 10) answer 1366