login
Fibonacci numbers with two 1's in the binary representation.
3

%I #29 Dec 07 2019 12:18:26

%S 3,5,34,144

%N Fibonacci numbers with two 1's in the binary representation.

%C Fibonacci numbers of the form 2^a + 2^b, a>b.

%C Elkies (2014) proved that there are no other terms.

%C This sequence is one row of A222296. - _T. D. Noe_, Mar 08 2013

%H Noam D. Elkies, <a href="http://mathoverflow.net/questions/159142/hamming-weight-of-fibonacci-numbers/159144#159144">Fibonacci numbers with Hamming weight 2</a>, Mathoverflow, 2014.

%e 144 = 128 + 16 = 2^7 + 2^4, thus it is in the sequence.

%t Select[Fibonacci[Range[1000]], DigitCount[#, 2, 1] == 2 &] (* _Alonso del Arte_, Feb 21 2013 *)

%o (Python)

%o prev = 0

%o curr = 1

%o for n in range(3000000):

%o c = 0 # count 1's

%o p = 1

%o while p<=prev:

%o c += ((prev & p) > 0)

%o if c>2:

%o break

%o p += p

%o if n&1023==0:

%o print '.',

%o if c==2:

%o print prev,

%o prev, curr = curr, prev+curr

%Y Cf. A000045, A004685, A222296.

%K nonn,full,fini

%O 1,1

%A _Alex Ratushnyak_, Feb 20 2013

%E full, fini keywords added by _Max Alekseyev_, May 13 2014