%I #26 Oct 26 2023 22:51:04
%S 7,14,15,23,28,29,30,31,39,46,47,55,56,57,58,59,60,61,62,63,71,78,79,
%T 87,92,93,94,95,103,110,111,112,113,114,115,116,117,118,119,120,121,
%U 122,123,124,125,126,127,135,142,143,151,156,157,158,159,167
%N Binary expansion contains 3 adjacent 1's.
%H Reinhard Zumkeller, <a href="/A004781/b004781.txt">Table of n, a(n) for n = 1..10000</a>
%H <a href="/index/Ar#2-automatic">Index entries for 2-automatic sequences</a>.
%F a(n) ~ n. - _Charles R Greathouse IV_, Sep 24 2012
%p q:= n-> verify([1$3], Bits[Split](n), 'sublist'):
%p select(q, [$0..200])[]; # _Alois P. Heinz_, Oct 22 2021
%t Select[Range[200],MemberQ[Partition[IntegerDigits[#,2],3,1], {1,1,1}]&] (* _Harvey P. Dale_, Mar 31 2011 *)
%t Select[Range[200], StringContainsQ[IntegerString[#, 2], "111"] &] (* _Amiram Eldar_, Oct 22 2021 *)
%t Select[Range[200],SequenceCount[IntegerDigits[#,2],{1,1,1}]>0&] (* _Harvey P. Dale_, Dec 28 2021 *)
%o (Haskell)
%o a004781 n = a004781_list !! (n - 1)
%o a004781_list = filter f [0..] where
%o f x | x < 7 = False
%o | otherwise = (x `mod` 8) == 7 || f (x `div` 2)
%o -- _Reinhard Zumkeller_, Jun 03 2012
%o (PARI) is(n)=!!bitand(bitand(n,n<<1),n<<2) \\ _Charles R Greathouse IV_, Sep 24 2012
%Y Complement of A003726.
%Y Cf. A004779, A136037.
%K nonn,base,easy
%O 1,1
%A _N. J. A. Sloane_
%E Offset corrected by _Reinhard Zumkeller_, Jun 03 2012
|