Return the first N items of the Fibonacci sequence.
The input will be a whole number greater than or equal to zero.
The output should be iterable.
Examples:
(0) => [0]
(5) => [0, 1, 1, 2, 3, 5]
(9) => [0, 1, 1, 2, 3, 5, 8, 13, 21, 34]
*^You can assume that you will always recieved valid input
Language: PHP
Length: 60
Solution: (Work in progress: as it misses F0 and F1, and becomes inaccurate quite quickly due to the low-precision, you could replace
0.618
with something like((1 + sqrt(5)) / 2) - 1)
for slightly better accuracy.)Language: Ruby
Length: 44
Solution: (Another work in progress, this one is more accurate than the PHP version)