diff --git a/src/Julia/Problem002.jl b/src/Julia/Problem002.jl new file mode 100644 index 0000000..77288e4 --- /dev/null +++ b/src/Julia/Problem002.jl @@ -0,0 +1,34 @@ +#= +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 +=# + +function Problem2() + #= + Statement + =# + + ans = 0 + limit = 4_000_000 + x, y = 1, 1 + z = x + y # Because every third Fibonacci number is even + while z <= limit + ans += z + x = y + z + y = z + x + z = x + y + end + + return ans +end + + +println("Time to evaluate Problem 2:") +@time Problem2() +println("") +println("Result for Problem 2: ", Problem2()) \ No newline at end of file