Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/k-s-a/euler_fib_even_sum


https://github.com/k-s-a/euler_fib_even_sum

Last synced: 5 days ago
JSON representation

Awesome Lists containing this project

README

        

# Even Fibonacci numbers ([link](https://projecteuler.net/problem=2))

> 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, ...
>
> By considering the terms in the Fibonacci sequence whose values do not exceed four million, find the sum of the even-valued terms.

## Use

Type in console:

```
% ./bin/fib 4000000
Sum of all even Fibonacci numbers, that less than 4000000 is 4613732.
% ./bin/fib 999999999
Sum of all even Fibonacci numbers, that less than 999999999 is 350704366.
% ./bin/fib 999999999999
Sum of all even Fibonacci numbers, that less than 999999999999 is 478361013020.
```

## Build

`% go install fib`

## Tests

```
% go test
ok fib 0.006s
```