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

 

Learn to build Production-Ready Serverless applications

Want to learn how to build Serverless applications and follow best practices? Subscribe to my newsletter and join over 3,000 AWS & Serverless enthusiasts who have signed up already.
As a BONUS, you will receive early access and discount for my new AppSync course.

Leave a Comment

Your email address will not be published.