problem2 filter the even numbers in the Fibonacci sequence then sum them.

problem2(limit)

Arguments

limit

Fibonacci value limit

Value

A total of the sum.

Complexity

This function has the following complexity O($n^2$)

See also

https://projecteuler.net/problem=2 for more info about it.

Examples

problem2(1)
#> [1] 0
problem2(10)
#> [1] 10
problem2(100)
#> [1] 44