cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A307451 Sum of binary weights of two consecutive Fibonacci numbers minus the binary weight of the following Fibonacci number.

This page as a plain text file.
%I A307451 #25 Apr 14 2019 19:07:25
%S A307451 0,1,0,1,3,0,1,4,0,3,7,1,1,7,2,5,11,6,1,7,6,3,13,11,3,4,9,10,15,9,10,
%T A307451 7,10,14,11,9,16,12,6,11,19,15,12,19,12,23,22,7,12,19,18,17,18,11,17,
%U A307451 27,13,20,28,17,9,22,29,18,26,18,30,18,15,24,20,20,28,28,24,24,18,21,28
%N A307451 Sum of binary weights of two consecutive Fibonacci numbers minus the binary weight of the following Fibonacci number.
%C A307451 The binary weight of a positive Fibonacci number is at least 1 (and at least 2 for positive Fibonacci numbers other than 1, 2, 8) but not more than the sum of the binary weights of the previous two Fibonacci numbers.
%C A307451 Therefore a(n) is at least 0, at most n - 1.
%C A307451 Number of carries in base-2 addition of A000045(n-2)+A000045(n-1)=A000045(n). - _Robert Israel_, Apr 14 2019
%H A307451 Robert Israel, <a href="/A307451/b307451.txt">Table of n, a(n) for n = 2..10000</a>
%H A307451 Dario Carrasquel, <a href="https://dariocarrasquel.com/2016/08/26/5-ways-to-solve-fibonacci-in-scala-tail-recursion-memoization-the-pisano-period-more/">5 ways to solve Fibonacci in Scala - Tail Recursion, Memoization, The Pisano Period & More</a>, August 26, 2016.
%F A307451 a(n) = (A011373(n - 2) + A011373(n - 1)) - A011373(n).
%e A307451 Fibonacci(8) = 21 = 10101 in binary.
%e A307451 Fibonacci(9) = 34 = 100010 in binary.
%e A307451 Fibonacci(10) = 55 = 110111 in binary, which has five 1s. We see that 10101 has three 1s and 100010 just two. Thus a(10) = 0.
%p A307451 B:= map(t -> convert(convert(combinat:-fibonacci(t),base,2),`+`), [$0..100]):
%p A307451 B[1..-3]-B[2..-2]-B[3..-1]; # _Robert Israel_, Apr 14 2019
%t A307451 Table[(DigitCount[Fibonacci[n - 2], 2, 1] + DigitCount[Fibonacci[n - 1], 2, 1]) - DigitCount[Fibonacci[n], 2, 1], {n, 2, 100}]
%o A307451 (Scala) def fibonacci(n: BigInt): BigInt = {
%o A307451   val zero = BigInt(0)
%o A307451   def fibTail(n: BigInt, a: BigInt, b: BigInt): BigInt = n match {
%o A307451     case `zero` => a
%o A307451     case _ => fibTail(n - 1, b, a + b)
%o A307451   }
%o A307451   fibTail(n, 0, 1)
%o A307451 } // Based on "Case 3: Tail Recursion" from Carrasquel (2016) link
%o A307451 (2 to 100).map(n => (fibonacci(n - 2).bitCount + fibonacci(n - 1).bitCount) - fibonacci(n).bitCount)
%o A307451 (PARI) f(n) = hammingweight(fibonacci(n)); \\ A011373
%o A307451 a(n) = f(n-1) + f(n-2) - f(n); \\ _Michel Marcus_, Apr 14 2019
%Y A307451 Cf. A000045, A000120, A011373.
%K A307451 nonn,easy,base
%O A307451 2,5
%A A307451 _Alonso del Arte_, Apr 08 2019