Files
project-euler/src/Julia/Problems001-050/Problem016.jl
2023-04-11 19:09:54 +02:00

31 lines
540 B
Julia

using Base: Integer
#=
Created on 26 Jul 2021
@author: David Doblas Jiménez
@email: daviddoji@pm.me
Solution for Problem 016 of Project Euler
https://projecteuler.net/problem=16
=#
using BenchmarkTools
function Problem016()
#=
2^15 = 32768 and the sum of its digits is 3 + 2 + 7 + 6 + 8 = 26.
What is the sum of the digits of the number 2^1000?
=#
n = 1_000
return sum(digits(2^big(n)))
end
println("Took:")
@btime Problem016()
println("")
println("Result for Problem $(lpad(16, 3, "0")): ", Problem016())