Add problem statement
This commit is contained in:
parent
e45bcfdc4d
commit
cb9e385215
@ -10,7 +10,13 @@ https://projecteuler.net/problem=2
|
|||||||
|
|
||||||
function Problem2()
|
function Problem2()
|
||||||
#=
|
#=
|
||||||
Statement
|
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.
|
||||||
=#
|
=#
|
||||||
|
|
||||||
ans = 0
|
ans = 0
|
||||||
@ -23,7 +29,7 @@ function Problem2()
|
|||||||
y = z + x
|
y = z + x
|
||||||
z = x + y
|
z = x + y
|
||||||
end
|
end
|
||||||
|
|
||||||
return ans
|
return ans
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user