3 ms·
Why not just directly get an approximation of the golden ratio by taking fib(n) / fib(n-1)? If you use an iterative / tail-recursive version you can actually d
by TheLoneWolfling 13y ago
Why not just directly get an approximation of the golden ratio by taking fib(n) / fib(n-1)?
If you use an iterative / tail-recursive version you can actually do this directly, without even the overhead of having to calculate it twice.
(I.e. define fib to return a tuple / struct / etc consisting of (fib(n), fib(n-1)).)
- NAFV_P 13y ago> Why not just directly get an approximation of the golden ratio by taking fib(n) / fib(n-1)? That has been done millions of times over the past 800 odd years. My method has no practical uses, but plenty of educational ones.