Add newline for consistency
This commit is contained in:
parent
233979c01f
commit
89caae5244
@ -17,6 +17,7 @@ function Problem1()
|
|||||||
|
|
||||||
Find the sum of all the multiples of 3 or 5 below 1000.
|
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)
|
ans = sum(x for x in 0:999 if x%3==0 || x%5==0)
|
||||||
|
|
||||||
return ans
|
return ans
|
||||||
|
@ -1,23 +1,23 @@
|
|||||||
#=
|
#=
|
||||||
Created on 08 Jun 2021
|
Created on 08 Jun 2021
|
||||||
|
|
||||||
@author: David Doblas Jiménez
|
@author: David Doblas Jiménez
|
||||||
@email: daviddoji@pm.me
|
@email: daviddoji@pm.me
|
||||||
|
|
||||||
Solution for Problem 2 of Project Euler
|
Solution for Problem 2 of Project Euler
|
||||||
https://projecteuler.net/problem=2
|
https://projecteuler.net/problem=2 =#
|
||||||
=#
|
|
||||||
|
using BenchmarkTools
|
||||||
|
|
||||||
function Problem2()
|
function Problem2()
|
||||||
#=
|
#=
|
||||||
Each new term in the Fibonacci sequence is generated by adding the
|
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:
|
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, ...
|
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
|
Find the sum of all the even-valued terms in the sequence which do not
|
||||||
exceed four million.
|
exceed four million. =#
|
||||||
=#
|
|
||||||
|
|
||||||
ans = 0
|
ans = 0
|
||||||
limit = 4_000_000
|
limit = 4_000_000
|
||||||
@ -35,6 +35,6 @@ end
|
|||||||
|
|
||||||
|
|
||||||
println("Time to evaluate Problem 2:")
|
println("Time to evaluate Problem 2:")
|
||||||
@time Problem2()
|
@btime Problem2()
|
||||||
println("")
|
println("")
|
||||||
println("Result for Problem 2: ", Problem2())
|
println("Result for Problem 2: ", Problem2())
|
Loading…
x
Reference in New Issue
Block a user