OFFSET
0,5
LINKS
Alois P. Heinz, Table of n, a(n) for n = 0..10000 (first 1001 terms from T. D. Noe)
FORMULA
a(n) = [x^Fibonacci(n)] (1/(1 - x))*Sum_{k>=0} x^(2^k)/(1 + x^(2^k)). - Ilya Gutkovskiy, Mar 27 2018
Conjecture: Limit_{n->oo} a(n)/n = log_2(phi)/2 = A242208/2 = 0.3471209568... . - Amiram Eldar, May 13 2022
EXAMPLE
a(8) = 3 because Fibonacci(8) = 21, which in binary is 11001 and that has 3 on bits.
a(9) = 2 because Fibonacci(9) = 34, which in binary is 100010 and that only has 2 on bits.
MAPLE
A000120 := proc(n) add(d, d=convert(n, base, 2)) ; end proc:
seq(A011373(n), n=0..50) ; # R. J. Mathar, Mar 22 2011
MATHEMATICA
DigitCount[#, 2, 1]&/@Fibonacci[Range[0, 79]] (* Harvey P. Dale, Mar 14 2011 *)
Table[Plus@@IntegerDigits[Fibonacci[n], 2], {n, 0, 79}]
PROG
(PARI) a(n)=hammingweight(fibonacci(n)) \\ Charles R Greathouse IV, Mar 02 2014
(Scala) def fibonacci(n: BigInt): BigInt = {
val zero = BigInt(0)
def fibTail(n: BigInt, a: BigInt, b: BigInt): BigInt = n match {
case `zero` => a
case _ => fibTail(n - 1, b, a + b)
}
fibTail(n, 0, 1)
} // Based on tail recursion by Dario Carrasquel
(0 to 79).map(fibonacci(_).bitCount) // Alonso del Arte, Apr 13 2019
CROSSREFS
KEYWORD
nonn,base
AUTHOR
STATUS
approved