Project Euler – Problem 16 Solution

Presently sponsored by Serverless Guru: Your guide to cloud excellence, helping you every step of your serverless journey, including team training, pattern development, mass service migrations, architecting, and developing new solutions. Speak to a Guru today.

Problem

215 = 32768 and the sum of its digits is 3 + 2 + 7 + 6 + 8 = 26.

What is the sum of the digits of the number 21000?

Solution

let number = 2I**1000
let answer = number.ToString() |> Seq.map (fun c -> int32(c.ToString())) |> Seq.sum

Leave a Comment

Your email address will not be published. Required fields are marked *