A173021 Number of numbers <= n whose binary representation is without isolated ones or isolated double ones.
1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 5, 5, 6, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8, 9, 9, 10, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11
Offset: 0
Examples
a(30) = #{0, 7, 14, 15, 28, 30} = #{0, 111, 1110, 1111, 11100, 11110} = 6.
Links
- Reinhard Zumkeller, Table of n, a(n) for n = 0..10000
Programs
-
Mathematica
ioQ[n_]:=Module[{idn2=Split[IntegerDigits[n,2]]},FreeQ[idn2,{1}]&&FreeQ[ idn2,{1,1}]]; Accumulate[Table[If[ioQ[n],1,0],{n,0,90}]] (* Harvey P. Dale, May 15 2016 *)