login
Numbers whose binary expansion contains the substring '011'.
7

%I #43 Apr 11 2021 04:52:27

%S 11,19,22,23,27,35,38,39,43,44,45,46,47,51,54,55,59,67,70,71,75,76,77,

%T 78,79,83,86,87,88,89,90,91,92,93,94,95,99,102,103,107,108,109,110,

%U 111,115,118,119,123,131,134,135,139,140,141,142,143,147,150

%N Numbers whose binary expansion contains the substring '011'.

%H Indranil Ghosh, <a href="/A004750/b004750.txt">Table of n, a(n) for n = 1..32769</a> (terms 1..1001 from Harvey P. Dale)

%H <a href="/index/Ar#2-automatic">Index entries for 2-automatic sequences</a>.

%F a(n) ~ n. - _Charles R Greathouse IV_, Oct 23 2015

%e 19 is in the sequence because 19 = 10011_2 and '10011' has '011' as one of its substrings. - _Indranil Ghosh_, Feb 11 2017

%t Select[Range[200],MemberQ[Partition[IntegerDigits[#,2],3,1],{0,1,1}]&] (* _Harvey P. Dale_, Apr 14 2014 *)

%t Select[Range[200],SequenceCount[IntegerDigits[#,2],{0,1,1}]>0&] (* Requires Mathematica version 10 or later *) (* _Harvey P. Dale_, Apr 01 2021 *)

%o (Python)

%o i=j=0

%o while j<=100:

%o if "011" in bin(i)[2:]:

%o print(str(j)+" "+str(i))

%o j+=1

%o i+=1 # _Indranil Ghosh_, Feb 11 2017

%o (PARI) is(n)=while(n>10, if(bitand(n, 7)==3, return(1)); n>>=1); 0 \\ _Charles R Greathouse IV_, Feb 11 2017

%Y Cf. A004749, A004751, A004752, A004753.

%K nonn,easy,base

%O 1,1

%A _N. J. A. Sloane_

%E Offset corrected by _Charles R Greathouse IV_, Feb 11 2017