%I #19 Apr 07 2020 21:49:24
%S 2,5,10,11,12,13,18,19,20,21,22,23,25,26,29,34,37,38,40,41,42,43,44,
%T 45,46,47,50,51,52,53,56,58,61,66,69,70,71,74,75,76,77,78,80,81,82,83,
%U 84,85,86,87,88,89,90,91,92,93,94,95,98,100,101,102,103,104
%N Write the positive integer n in binary. Subdivide the binary n into runs each consisting entirely of 0's or of 1's, where the runs alternate between those of 1's and those of 0's. The sequence gives those numbers n such that there is at least one run of 1's of the same length as at least one run of 0's.
%H Charles R Greathouse IV, <a href="/A123466/b123466.txt">Table of n, a(n) for n = 1..10000</a>
%F a(n) ~ n. - _Charles R Greathouse IV_, Mar 29 2013
%e 25 written in binary is 11001. The runs are (11)(00)(1). Since at least one run of 1's (the leftmost run here) is the same length as at least one run of 0's (the only run of 0's here), 25 is included in this sequence.
%o (PARI) is(n)=my(ones=List(),zeros=List()); if(n%2, listput(ones, valuation(n+1,2)); n>>=ones[1]); while(n, listput(zeros, valuation(n,2)); n>>=zeros[#zeros]; listput(ones, valuation(n+1,2)); n>>=ones[#ones]); #setintersect(vecsort(Vec(ones),,8), vecsort(Vec(zeros),,8))>0 \\ _Charles R Greathouse IV_, Mar 29 2013
%Y Cf. A033015.
%K base,easy,nonn
%O 1,1
%A _Leroy Quet_, Jul 11 2008
%E a(16) to a(27) from _Ray G. Opao_, Jan 08 2009
%E a(28)-a(64) from _Lars Blomberg_, Dec 09 2011
|