# Greetings from The On-Line Encyclopedia of Integer Sequences! http://oeis.org/ Search: id:a079071 Showing 1-1 of 1 %I A079071 #15 Apr 18 2018 18:22:42 %S A079071 0,0,0,0,0,0,1,0,0,0,1,0,2,1,2,0,0,0,1,0,2,1,2,0,3,3,4,1,5,2,3,0,0,0, %T A079071 1,0,2,1,2,0,3,3,4,1,5,2,3,0,4,6,7,4,8,5,6,1,9,7,8,2,9,3,4,0,0,0,1,0, %U A079071 2,1,2,0,3,3,4,1,5,2,3,0,4,6,7,4,8,5,6,1,9,7,8,2,9,3,4,0,5,10,11,10,12,11,12 %N A079071 Number of numbers < n whose binary representation has the same number of 0's and 1's as n does. %H A079071 Alois P. Heinz, Table of n, a(n) for n = 0..16383 %p A079071 f:= n-> (x-> (t-> t*(t+1)/2+x[2])(x[1]+x[2]))(add( %p A079071 `if`(i=0, [1, 0], [0, 1]), i=convert(n, base, 2))): %p A079071 b:= proc(n) b(n):= b(n-1)+x^f(n) end: b(-1):=0: %p A079071 a:= n-> coeff(b(n-1), x, f(n)): %p A079071 seq(a(n), n=0..150); # _Alois P. Heinz_, Feb 08 2018 %t A079071 a[n_] := Count[Range[n-1], k_ /; DigitCount[n, 2] == DigitCount[k, 2]]; %t A079071 Table[a[n], {n, 0, 104}] (* _Jean-François Alcover_, Feb 13 2018 *) %Y A079071 Cf. A079070, A068076, A079074, A007088, A023416, A000120. %K A079071 nonn,look %O A079071 0,13 %A A079071 _Reinhard Zumkeller_, Dec 21 2002 # Content is available under The OEIS End-User License Agreement: http://oeis.org/LICENSE