login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

Numbers whose numbers of zeros and ones in binary representation differ at most by 1.
5

%I #17 Mar 31 2015 17:31:24

%S 0,1,2,4,5,6,9,10,12,17,18,19,20,21,22,24,25,26,28,35,37,38,41,42,44,

%T 49,50,52,56,67,69,70,71,73,74,75,76,77,78,81,82,83,84,85,86,88,89,90,

%U 92,97,98,99,100,101,102,104,105,106,108,112,113,114,116,120,135,139

%N Numbers whose numbers of zeros and ones in binary representation differ at most by 1.

%C A031443 is a subsequence; abs(A037861(a(n))) <= 1.

%H Reinhard Zumkeller, <a href="/A089648/b089648.txt">Table of n, a(n) for n = 1..10000</a>

%H Eric Weisstein's World of Mathematics, <a href="http://mathworld.wolfram.com/DigitCount.html">Digit Count</a>

%H <a href="/index/Bi#binary">Index entries for sequences related to binary expansion of n</a>

%t Select[Range[0,7! ],Abs[DigitCount[ #,2,0]-DigitCount[ #,2,1]]<2 &] (* _Vladimir Joseph Stephan Orlovsky_, Feb 16 2010 *)

%o (Haskell)

%o a089648 n = a089648_list !! (n-1)

%o a089648_list = filter ((<= 1) . abs . a037861) [0..]

%o -- _Reinhard Zumkeller_, Mar 31 2015

%Y Cf. A023416, A000120.

%Y Cf. A037861, union of A031443, A031444 and A031448.

%K nonn,base

%O 1,3

%A _Reinhard Zumkeller_, Jan 02 2004