diff --git a/src/Julia/Problem016.jl b/src/Julia/Problem016.jl new file mode 100644 index 0000000..670ae1f --- /dev/null +++ b/src/Julia/Problem016.jl @@ -0,0 +1,26 @@ +using Base: Integer +#= +Created on 26 Jul 2021 + +@author: David Doblas Jiménez +@email: daviddoji@pm.me + +Solution for Problem 16 of Project Euler +https://projecteuler.net/problem=16 +=# + +function Problem16() + #= + 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 = 1000 + return sum(parse(Int, d) for d in string(2^BigInt(n))) +end + + +println("Time to evaluate Problem 16:") +@time Problem16() +println("") +println("Result for Problem 16: ", Problem16())