4 ms·
Yes. You can get the same approximate closed-form Fibonacci behavior in Julia with this definition: cfib(n) = ((1+sqrt(5))^n - (1-sqrt(5))^n)/(2.0^n*sqrt(5))
by StefanKarpinski 14y ago
Yes. You can get the same approximate closed-form Fibonacci behavior in Julia with this definition:
cfib(n) = ((1+sqrt(5))^n - (1-sqrt(5))^n)/(2.0^n*sqrt(5))
julia> cfib(128)
2.5172882568355055e26
Unfortunately, this approximate value is off by 1066512995643 (~1 trillion), so it's hard to see how it would be useful. Actually, it's hard to think of good uses for computing Fibonacci numbers in general :-)