Solution to problem 48 in Julia

This commit is contained in:
David Doblas Jiménez 2021-09-18 10:00:20 +02:00
parent 6bdb1455c8
commit 7702c0bdee

27
src/Julia/Problem048.jl Normal file
View File

@ -0,0 +1,27 @@
#=
Created on 18 Sep 2021
@author: David Doblas Jiménez
@email: daviddoji@pm.me
Solution for Problem 48 of Project Euler
https://projecteuler.net/problem=48
=#
using BenchmarkTools
function Problem48()
#=
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.
=#
series = sum(big(i)^i for i in 1:1000)
return string(series)[end-9:end]
end
println("Time to evaluate Problem 48:")
@btime Problem48()
println("")
println("Result for Problem 48: ", Problem48())