A107907 Numbers having consecutive zeros or consecutive ones in binary representation.
3, 4, 6, 7, 8, 9, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77
Offset: 1
Examples
From _Gus Wiseman_, Nov 27 2019: (Start) The sequence of terms together with their binary expansions begins: 3: 11 4: 100 6: 110 7: 111 8: 1000 9: 1001 11: 1011 12: 1100 13: 1101 14: 1110 15: 1111 16: 10000 17: 10001 18: 10010 (End)
Links
- Amiram Eldar, Table of n, a(n) for n = 1..10000
Crossrefs
Programs
-
Mathematica
Select[Range[100],MatchQ[IntegerDigits[#,2],{_,x_,x_,_}]&] (* Gus Wiseman, Nov 27 2019 *) Select[Range[80],SequenceCount[IntegerDigits[#,2],{x_,x_}]>0&] (* or *) Complement[Range[85],Table[FromDigits[PadRight[{},n,{1,0}],2],{n,7}]] (* Harvey P. Dale, Jul 31 2021 *)
-
Python
def A107907(n): return (m:=n-2+(k:=(3*n+3).bit_length()))+(m>=(1<
Chai Wah Wu, Apr 21 2025
Formula
Extensions
Offset changed to 1 by Chai Wah Wu, Apr 21 2025
Comments