Fibonacci numbers can also be considered as a function of non-negative integers:
n = 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, ... F(n) = 0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, ...
F(n) = (Phi^n – PhiP^n)/Sqrt(5) (good for all integer n >= 0 or n < 0), where Phi = (1 + Sqrt(5))/2 = the Golden Ratio = 1.61803398874989484820..., and PhiP = Phi Prime = (1 – Sqrt(5))/2 = 1 – Phi = –1/Phi = –0.61803398874989484820...,
F(n) = Round(Phi^n / Sqrt(5)), n >= 0.
AFib(x) = 0 if |x| < 1, else AFib(x) = Round(Ln(sqrt(5)*|x|) / Ln(Phi)).
Fibonacci numbers can also be defined for negative n:
F(–2*n) = –F(2*n) F(–2*n – 1) = F(2*n + 1) n = ..., –6, –5, –4, –3, –2, –1, 0, 1, 2, 3, 4, 5, 6, ... F(n) = ..., –8, 5, –3, 2, –1, 1, 0, 1, 1, 2, 3, 5, 8, ...
Set equal to 1 (True) if |x| is a Fibonacci number, else it is set to 0 (False). True iff x = 0 or z = |x| is an integer and the closed interval [Phi*z – 1/z, Phi*z + 1/z] contains a positive integer. Extra testing is performed if x < 0 and |x| is a Fibonacci number. 144, 233, and –144 are Fibonacci number, but –233 is not. For x < 0 to be a Fibonacci number, |x| must be a Fibonacci number and AFib(|x|) must be even.
IsFib2(X) = IsFib(X) by second method:
Same as IsFib(X) except true iff x = 0 or z = |x| is an integer and 5*x^2 + 4 or 5*x^2 – 4 is a perfect square.
The continuous analytic function:
Fe(x) = (Phi^x – 1 / Phi^x) / Sqrt(5),
The continuous analytic function:
Fo(x) = (Phi^x + 1 / Phi^x) / Sqrt(5),
The continuous analytic function:
Fib(x) = (1 + cos(x*Pi))*Fe(x)/2 + (1 – cos(x*Pi))*Fo(x)/2,
This last expression can be reduced to:
Fib(x) = (Phi^x – cos(x*Pi) / Phi^x) / sqrt(5).
This formula can even be used to compute the generalized Fibonacci function of a complex variable. For example Fib(3 + 4*i) = –5248.51130,72837,20182,8... –14195.96228,83530,10885,8... * i.
It is still true that Fib(x+2) = Fib(x+1) + Fib(x). For example Fib(3.6 + 4.7*i) = Fib(2.6 + 4.7*i) + Fib(1.6 + 4.7*i).
Return to Fibonacci Numbers
Return to Number Theory, Algorithms, and Real Functions
Return to Harry's Home Page