This repository has been archived on 2024-01-26. You can view files and clone it, but cannot push or open issues or pull requests.
project-euler/2/euler002.jl

23 lines
316 B
Julia
Executable file

#!/usr/bin/julia
function euler002(limit)
prevFib = 1
fib = 1
fibSum = 0
while fib < limit
if fib % 2 == 0
fibSum += fib
end
nextFib = prevFib + fib
prevFib = fib
fib = nextFib
end
return fibSum
end
euler002(1)
@time euler002(4*10^6)