This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.
%I A175061 #11 Jan 05 2021 03:30:46 %S A175061 1,4,6,35,39,49,55,57,59,536,540,560,572,624,632,776,782,784,798,880, %T A175061 888,900,902,912,926,944,956,964,966,968,974,984,988,16775,16783, %U A175061 16835,16847,16867,16871,17159,17183,17283,17311,17379,17383,17935,17951 %N A175061 A positive integer n is included if n, when written in binary, is made of run-lengths (lengths of runs of 0's as well as of runs of 1's) that form a permutation of some number of consecutive positive integers starting with 1. %C A175061 Think of binary n as a string S of 0's and 1's. By a "run" of 0's or 1's, it is meant either a substring all of contiguous 0's, each run bounded by 1's or the edge of S; or a substring all of contiguous 1's, each run bounded by 0's or the edge of S. %C A175061 This sequence contains those terms of A161001 that each contain a run of length 1. %H A175061 Michael S. Branicky, <a href="/A175061/b175061.txt">Table of n, a(n) for n = 1..10000</a> %e A175061 536 in binary is 1000011000. This contains a run of one 1, followed by a run of four 0's, followed by a run of two 1's, followed finally by a run of three 0's. So the run lengths are (1,4,2,3). And since this is a permutation of (1,2,3,4), then 536 is in the sequence. %o A175061 (Python) %o A175061 from itertools import groupby %o A175061 def ok(n): %o A175061 runlengths = [len(list(g)) for k, g in groupby(bin(n)[2:])] %o A175061 return sorted(runlengths) == list(range(1, len(runlengths)+1)) %o A175061 print([n for n in range(1, 17952) if ok(n)]) # _Michael S. Branicky_, Jan 04 2021 %o A175061 (Python) # alternate that directly generates terms %o A175061 from itertools import permutations %o A175061 def runlength(r): # all terms with runlengths a permutation of 1, ..., r %o A175061 c = ['1', '0'] %o A175061 return sorted([int("".join([c[j%2]*p[j] for j in range(r)]), 2) %o A175061 for p in permutations(range(1, r+1))]) %o A175061 def aupto(nn): %o A175061 r, out = 1, [] %o A175061 while len(out) < nn: %o A175061 out += runlength(r) %o A175061 r += 1 %o A175061 return out[:nn] %o A175061 print(aupto(47)) # _Michael S. Branicky_, Jan 04 2021 %Y A175061 Cf. A161001, A175062 %K A175061 base,nonn %O A175061 1,2 %A A175061 _Leroy Quet_, Dec 12 2009 %E A175061 Extended by _Ray Chandler_, Dec 16 2009