OFFSET
1,1
COMMENTS
A175020 contains those positive integers not in this sequence.
LINKS
Michael De Vlieger, Table of n, a(n) for n = 1..10000
EXAMPLE
9 in binary is 1001. The run lengths form the multiset (1,2,1). Since no positive integer < 9 has this same multiset of run lengths, then 9 is not in this sequence.
On the other hand, 23 in binary is 10111. The run-lengths are (1,1,3). But 17 (which is < 23) in binary is 10001, which has the run-lengths of (1,3,1). Since the multisets (1,1,3) and (1,3,1) are identical, 23 is in this sequence.
MATHEMATICA
Block[{nn = 109, s}, s = Array[Sort@ Map[Length, Split@ IntegerDigits[#, 2]] &, nn]; Complement[Range[nn], Values[PositionIndex@ s][[All, 1]] ]] (* Michael De Vlieger, Sep 03 2017 *)
PROG
(PARI) {A175021_first(n)=my(k, S=[]); vector(n, R, while(!setsearch(S, R=vecsort(A101211_row(k++))), S=setunion(S, [R])); k)} \\ M. F. Hasler, Mar 11 2025
(Python)
from itertools import count, groupby
def A175021(n=None, stop=3**33): # return a(n) or generator of sequence if no n given
if not n: return(A175021(n)for n in range(1, stop))
if not hasattr(A := A175021, 'terms'): A.terms=[0]; A.rls=set(); A.signature=\
lambda n: tuple(sorted(len(list(g)) for _, g in groupby(bin(n)[2:])))
while n>=len(A.terms):
A.terms.append(next(k for k in count(A.terms[-1]+1)
if(s:=A.signature(k)) in A.rls or A.rls.add(s)))
return A.terms[n] # M. F. Hasler, Mar 11 2025
CROSSREFS
KEYWORD
nonn,base,changed
AUTHOR
Leroy Quet, Nov 03 2009
EXTENSIONS
Extended by Ray Chandler, Mar 11 2010
STATUS
approved