Project Euler – Problem 48 Solution

Problem

The series, 11 + 22 + 33 + … + 1010 = 10405071317.

Find the last ten digits of the series, 11 + 22 + 33 + … + 10001000.

Solution

let number = [1..1000] |> List.map (fun n -> pown (bigint(n)) n) |> List.sum

let answer = 
    number.ToString().ToCharArray() 
    |> Array.rev
    |> Seq.take 10 
    |> Seq.toArray 
    |> Array.rev


Yan Cui

I’m an AWS Serverless Hero and the author of Production-Ready Serverless. I have run production workload at scale in AWS for nearly 10 years and I have been an architect or principal engineer with a variety of industries ranging from banking, e-commerce, sports streaming to mobile gaming. I currently work as an independent consultant focused on AWS and serverless.

You can contact me via Email, Twitter and LinkedIn.

Hire me.