I’m beginning to learn F# and the best way for me to go about that is to start applying it. There are some interesting computational problems over at Project Euler . This post is the continuation of a series of posts each involving a separate Project Euler problem. This post involves solutions to Project Euler 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}?

open System open Microsoft.FSharp.Math let digits = let str = BigInt.Pow(2I,1000I).ToString() seq { for i = 0 to str.Length-1 do yield int(str.[i]) - int('0')} digits |> Seq.reduce (+) |> printfn "Answer = %d" |