I am reading a algorithms book by S.DasGupta. Following is text snippet from the text regarding number of bits required for nth Fibonacci number.
It is reasonable to treat addition as
a single computer step if small
numbers are being added, 32-bit
numbers say. But the nth Fibonacci
number is about
0.694n bits long, and this can far exceed 32 as n grows. Arithmetic
operations on arbitrarily large
numbers cannot possibly be performed
in a single, constant-time step.
My question is for eg, for Fibonacci number F1 = 1, F2 =1, F3=2, and so on. then substituting “n” in above formula i.e., 0.694n for F1 is approximately 1, F2 is approximately 2 bits, but for F3 and so on above formula fails. I think i didn’t understand propely what author mean here, can any one please help me in understanding this?
Thanks
Well,
Bits required is the base-2 log rounded up, so this is close enough for me.
The value 0.694 comes from the fact that
F(n)is the closest integer to (φn)/√5. Solog(F(n))isn * log(phi) - log(sqrt(5)), andlog(phi)is 0.694. Asngets bigger, thelog(sqrt(5))and the rounding rapidly become insignificant.