%I #49 Oct 04 2024 18:18:16
%S 2,4,6,8,12,14,16,24,28,30,32,48,56,60,62,64,96,112,120,124,126,128,
%T 192,224,240,248,252,254,256,384,448,480,496,504,508,510,512,768,896,
%U 960,992,1008,1016,1020,1022,1024,1536,1792,1920,1984,2016,2032,2040,2044
%N Numbers whose base-2 representation has exactly 2 runs.
%C Numbers whose binary representation contains the bit string "10" but not "01". Subsequence of A062289; set difference A062289 minus A101082. - _Rick L. Shepherd_, Nov 29 2004
%C Mersenne numbers (A000225) times powers of 2 (A000079). Therefore this sequence contains the even perfect numbers (A000396). - _Alonso del Arte_, Apr 21 2006
%H Lei Zhou, <a href="/A043569/b043569.txt">Table of n, a(n) for n = 1..10000</a>
%F This sequence is twice A023758. - _Franklin T. Adams-Watters_, Apr 21 2006
%F Sum_{n>=1} 1/a(n) = A065442. - _Amiram Eldar_, Feb 20 2022
%F A007814(a(n)) = A004736(n). - _Lorenzo Sauras Altuzarra_, Feb 01 2023
%p a:=proc(n) local nn,nd: nn:=convert(n,base,2): nd:={seq(nn[j]-nn[j-1],j=2..nops(nn))}: if n=2 then 2 elif nd={0,1} then n else fi end: seq(a(n),n=1..2100); # _Emeric Deutsch_, Apr 21 2006
%t Take[Sort[Flatten[Table[(2^x - 1)*(2^y), {x, 32}, {y, 32}]]], 54] (* _Alonso del Arte_, Apr 21 2006 *)
%t Select[Range[2500],Length[Split[IntegerDigits[#,2]]]==2&] (* or *) Select[Range[2500],SequenceCount[IntegerDigits[#,2],{1,0}]>0 && SequenceCount[ IntegerDigits[#,2],{0,1}]==0&] (* _Harvey P. Dale_, Oct 04 2024 *)
%o (Python)
%o def ok(n): b = bin(n)[2:]; return "10" in b and "01" not in b
%o print([m for m in range(2045) if ok(m)]) # _Michael S. Branicky_, Feb 04 2021
%o (Python)
%o def a_next(a_n): t = a_n >> 1; return (a_n | t) + (t & 1)
%o a_n = 2; a = []
%o for i in range(54): a.append(a_n); a_n = a_next(a_n) # _Falk Hüffner_, Feb 19 2022
%Y Cf. A004736, A007814, A062289, A065442, A101082.
%K nonn,base
%O 1,1
%A _Clark Kimberling_
%E More terms from _Rick L. Shepherd_, Nov 29 2004