A090077 In binary expansion of n: reduce contiguous blocks of 1's to 1.
0, 1, 2, 1, 4, 5, 2, 1, 8, 9, 10, 5, 4, 5, 2, 1, 16, 17, 18, 9, 20, 21, 10, 5, 8, 9, 10, 5, 4, 5, 2, 1, 32, 33, 34, 17, 36, 37, 18, 9, 40, 41, 42, 21, 20, 21, 10, 5, 16, 17, 18, 9, 20, 21, 10, 5, 8, 9, 10, 5, 4, 5, 2, 1, 64, 65, 66, 33, 68, 69, 34, 17, 72, 73, 74, 37, 36, 37, 18, 9
Offset: 0
Examples
100 -> '1100100' -> [11]00[1]00 -> [1]00[1]00 -> '100100' -> 36=a(100).
Links
Programs
-
Mathematica
Array[FromDigits[Flatten[Split@ IntegerDigits[#, 2] /. w_List /; First[w] == 1 -> {1}], 2] &, 80, 0] (* Michael De Vlieger, Jul 28 2022 *)
-
Python
def a(n): b = bin(n)[2:] while "11" in b: b = b.replace("11", "1") return int(b, 2) print([a(n) for n in range(81)]) # Michael S. Branicky, Jul 27 2022