A020909 Number of bits in the base-2 representation of the n-th Fibonacci number.
1, 1, 2, 2, 3, 4, 4, 5, 6, 6, 7, 8, 8, 9, 10, 10, 11, 12, 13, 13, 14, 15, 15, 16, 17, 17, 18, 19, 19, 20, 21, 22, 22, 23, 24, 24, 25, 26, 26, 27, 28, 28, 29, 30, 31, 31, 32, 33, 33, 34, 35, 35, 36, 37, 38, 38, 39, 40, 40, 41, 42, 42, 43, 44, 44, 45, 46, 47, 47, 48, 49, 49, 50, 51
Offset: 1
Programs
-
Mathematica
f[n_] := 1 + Floor@ Log2@ Fibonacci@ n; Array[f, 74] (* Robert G. Wilson v, Jun 24 2011 *) IntegerLength[#,2]&/@Fibonacci[Range[80]] (* Harvey P. Dale, Feb 11 2015 *)
-
PARI
a(n)={ if(n<99,return(#binary(fibonacci(n)))); localbitprec(logint(n*6351109\9148265,2)+64); my(s=sqrt(5),phi=(s+1)/2,x=n*log(phi)-log(s)); ceil(x/log(2)); } \\ Charles R Greathouse IV, Aug 24 2021
Formula
a(n) = 1 + floor( log_2( A000045(n) ) ).
Extensions
More terms from James Sellers