diff --git a/src/Julia/Problems001-050/Problem001.jl b/src/Julia/Problems001-050/Problem001.jl index 8877edf..1edb685 100644 --- a/src/Julia/Problems001-050/Problem001.jl +++ b/src/Julia/Problems001-050/Problem001.jl @@ -17,6 +17,7 @@ function Problem1() 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 diff --git a/src/Julia/Problems001-050/Problem002.jl b/src/Julia/Problems001-050/Problem002.jl index 34bb301..d085eb1 100644 --- a/src/Julia/Problems001-050/Problem002.jl +++ b/src/Julia/Problems001-050/Problem002.jl @@ -1,23 +1,23 @@ -#= +#= Created on 08 Jun 2021 @author: David Doblas Jiménez @email: daviddoji@pm.me Solution for Problem 2 of Project Euler -https://projecteuler.net/problem=2 -=# +https://projecteuler.net/problem=2 =# + +using BenchmarkTools function Problem2() - #= + #= Each new term in the Fibonacci sequence is generated by adding the previous two terms. By starting with 1 and 2, the first 10 terms will be: 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, ... Find the sum of all the even-valued terms in the sequence which do not - exceed four million. - =# + exceed four million. =# ans = 0 limit = 4_000_000 @@ -35,6 +35,6 @@ end println("Time to evaluate Problem 2:") -@time Problem2() +@btime Problem2() println("") println("Result for Problem 2: ", Problem2()) \ No newline at end of file