After writing a program in Java to generate Fibonacci numbers using a recursive algorithm, I noticed the time increase in each iteration is approximately $\Phi$ times greater than the previous.
$\Phi$ is the Golden Ratio, its value is approximately $1.61803398$ and is very closely related to the Fibonacci series.
Here is an output log from the program showing the current iteration number, value, and the time it took to calculate:
30: 832040, calc time: 0.00s, took 1.33333x longer than previous.
31: 1346269, calc time: 0.01s, took 1.50000x longer than previous.
32: 2178309, calc time: 0.01s, took 1.66667x longer than previous.
33: 3524578, calc time: 0.02s, took 1.80000x longer than previous.
34: 5702887, calc time: 0.03s, took 1.55556x longer than previous.
35: 9227465, calc time: 0.05s, took 1.75000x longer than previous.
36: 14930352, calc time: 0.08s, took 1.57143x longer than previous.
37: 24157817, calc time: 0.13s, took 1.66234x longer than previous.
38: 39088169, calc time: 0.21s, took 1.60938x longer than previous.
39: 63245986, calc time: 0.31s, took 1.48544x longer than previous.
40: 102334155, calc time: 0.50s, took 1.63399x longer than previous.
41: 165580141, calc time: 0.80s, took 1.60800x longer than previous.
42: 267914296, calc time: 1.30s, took 1.62065x longer than previous.
43: 433494437, calc time: 2.15s, took 1.65004x longer than previous.
44: 701408733, calc time: 3.47s, took 1.61395x longer than previous.
45: 1134903170, calc time: 5.80s, took 1.67205x longer than previous.
46: 1836311903, calc time: 9.03s, took 1.55619x longer than previous.
I skipped previous values as the time was too short to give a difference.
There definitely does seem to be a relationship between that time and $\Phi$,
I couldn't find any information which explains why this is so.
Here's the algorithm used, it simply gets the previous two values of itself until it gets to the beginning of the series:
function fib(number) {
if (number == 0) return 0;
if (number == 1) return 1;
if (number > 1) return fib(number - 2) + fib(number - 1);
}
Is there an explanation why this is happening?