27 lines
586 B
Julia
27 lines
586 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
|
|
=#
|
|
|
|
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:")
|
|
@time Problem1()
|
|
println("")
|
|
println("Result for Problem 1: ", Problem1()) |