# Project Euler #016

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}?

```
let rec exp n e =
match e = 0 with
| true -> 1I
| false -> n * exp n (e - 1)
let sum n =
n |> string |> Seq.fold (fun acc x -> acc + System.Int32.Parse(x |> string)) 0
exp 2I 1000 |> sum
```

comments powered by Disqus