David Doblas Jiménez 233979c01f Use benchmark macro
2021-09-28 09:55:48 +02:00

29 lines
609 B
Julia

#=
Created on 08 Jun 2021
@author: David Doblas Jiménez
@email: daviddoji@pm.me
Solution for Problem 1 of Project Euler
https://projecteuler.net/problem=1
=#
using BenchmarkTools
function Problem1()
#=
If we list all the natural numbers below 10 that are multiples of 3 or 5,
we get 3, 5, 6 and 9. The sum of these multiples is 23.
Find the sum of all the multiples of 3 or 5 below 1000.
=#
ans = sum(x for x in 0:999 if x%3==0 || x%5==0)
return ans
end
println("Time to evaluate Problem 1:")
@btime Problem1()
println("")
println("Result for Problem 1: ", Problem1())