A373082 Number of runs of 0's in A014550(n).
1, 0, 0, 1, 1, 0, 1, 1, 1, 1, 0, 1, 2, 1, 1, 1, 1, 1, 1, 2, 1, 0, 1, 1, 2, 2, 1, 2, 2, 1, 1, 1, 1, 1, 1, 2, 2, 1, 2, 2, 1, 1, 0, 1, 2, 1, 1, 1, 2, 2, 2, 3, 2, 1, 2, 2, 2, 2, 1, 2, 2, 1, 1, 1, 1, 1, 1, 2, 2, 1, 2, 2, 2, 2, 1, 2, 3, 2, 2, 2, 1, 1, 1, 2, 1, 0, 1, 1, 2, 2, 1, 2, 2, 1, 1, 1, 2, 2, 2, 3
Offset: 0
Crossrefs
Cf. A014550.
Programs
-
Python
def count_zero_runs_in_binary(n): binRep = bin(n)[2:] # as binary, but ignore "0b" prefix zRuns = binRep.split('1') # split on the 1's zRvec = [run for run in zRuns if run] # filter "" to get runs of 0 return len(zRvec) out = [] for i in range(100): gv = i ^ (i>>1) # gray code ans = count_zero_runs_in_binary(gv) out.append(ans) print(out)