4 ms·
Properties of the Fibonacci function: It is non-decreasing monotonic. fib(n) <= fib(n+1) It is increasing monotonic after 1. fib(n) < fib(n+1) Its domain
by travisjungroth 4y ago
Properties of the Fibonacci function:
It is non-decreasing monotonic.
fib(n) <= fib(n+1)
It is increasing monotonic after 1.
fib(n) < fib(n+1)
Its domain and codomain are non-negative integers.
fib(n) + fib(n+1) == fib(n+2)
Notice this is like the recursive solution except going the other way (addition not subtraction) and is missing the base case.
- xtagon 4y agoIt also converges closer and closer to the golden ratio. Implementing a property test for that would be interesting.
- travisjungroth 4y agoa, b, c = fib(n), fib(n+1), fib(n+2) assert abs(c / b - phi) < abs(b / a - phi)