### Project Euler - Problem 48

Description

The series, 1^1 + 2^2 + 3^3 + ... + 10^10 = 10405071317.

Find the last ten digits of the series, 1^1 + 2^2 + 3^3 + ... + 1000^1000

Solution

let powerBySelf num = bigint (float num)**(num)

let LastTenDigitisOfSumOfPowerBySelf =

let sum = [1..1000] |> List.map (fun x -> powerBySelf x) |> List.sum

let stringOfSum = sum.ToString()

stringOfSum.Substring(stringOfSum.Length-10)

The series, 1^1 + 2^2 + 3^3 + ... + 10^10 = 10405071317.

Find the last ten digits of the series, 1^1 + 2^2 + 3^3 + ... + 1000^1000

Solution

let powerBySelf num = bigint (float num)**(num)

let LastTenDigitisOfSumOfPowerBySelf =

let sum = [1..1000] |> List.map (fun x -> powerBySelf x) |> List.sum

let stringOfSum = sum.ToString()

stringOfSum.Substring(stringOfSum.Length-10)