Solution to problem 48 in Julia
This commit is contained in:
parent
6bdb1455c8
commit
7702c0bdee
27
src/Julia/Problem048.jl
Normal file
27
src/Julia/Problem048.jl
Normal 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())
|
Loading…
x
Reference in New Issue
Block a user