login
Numbers with adjacent 1's and no adjacent 0's in binary expansion.
2

%I #11 Jun 18 2020 10:09:54

%S 3,6,7,11,13,14,15,22,23,26,27,29,30,31,43,45,46,47,53,54,55,58,59,61,

%T 62,63,86,87,90,91,93,94,95,106,107,109,110,111,117,118,119,122,123,

%U 125,126,127,171,173,174,175,181,182,183,186,187,189,190,191,213,214,215

%N Numbers with adjacent 1's and no adjacent 0's in binary expansion.

%H Robert Israel, <a href="/A153033/b153033.txt">Table of n, a(n) for n = 1..10000</a>

%e a(1)=3 because bin(3)= 11.

%p filter:= proc(n) local L;

%p L:= convert(n,base,2);

%p L:= L[1..-2]+L[2..-1];

%p has(L,2) and not has(L,0)

%p end proc:

%p select(filter, [$3..300]); # _Robert Israel_, Jun 17 2020

%t fQ[n_] := Block[{st = Union@ Split@ IntegerDigits[n, 2]}, MemberQ[st, {1, __}] && !MemberQ[st, {0, __}]]; Select[Range@218, fQ@# &] (* _Robert G. Wilson v_, Dec 21 2008 *)

%t Select[Range[300],SequenceCount[IntegerDigits[#,2],{0,0}]== 0 && SequenceCount[ IntegerDigits[#,2],{1,1}]>0&] (* Requires Mathematica version 10 or later *) (* _Harvey P. Dale_, May 11 2017 *)

%K base,easy,nonn

%O 1,1

%A _Gil Broussard_, Dec 17 2008

%E Extended by _Robert G. Wilson v_, Dec 21 2008