cp's OEIS Frontend

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.

A175021 A positive integer k is included if k is not the smallest positive integer with its particular multiset of run-lengths (of either 0 or 1 considered together) in its binary representation.

This page as a plain text file.
%I A175021 #19 Mar 14 2025 19:47:52
%S A175021 6,11,13,14,20,22,23,25,26,27,28,29,30,38,39,40,41,43,44,45,46,47,49,
%T A175021 50,52,53,54,55,57,58,59,60,61,62,70,72,75,77,78,79,80,81,82,83,84,86,
%U A175021 87,88,89,90,91,92,93,94,95,97,98,100,101,102,103,104,105,106,107,108,109
%N A175021 A positive integer k is included if k is not the smallest positive integer with its particular multiset of run-lengths (of either 0 or 1 considered together) in its binary representation.
%C A175021 A175020 contains those positive integers not in this sequence.
%H A175021 Michael De Vlieger, <a href="/A175021/b175021.txt">Table of n, a(n) for n = 1..10000</a>
%e A175021 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.
%e A175021 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.
%t A175021 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 *)
%o A175021 (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
%o A175021 (Python)
%o A175021 from itertools import count, groupby
%o A175021 def A175021(n=None, stop=3**33): # return a(n) or generator of sequence if no n given
%o A175021     if not n: return(A175021(n)for n in range(1, stop))
%o A175021     if not hasattr(A := A175021, 'terms'): A.terms=[0]; A.rls=set(); A.signature=\
%o A175021         lambda n: tuple(sorted(len(list(g)) for _,g in groupby(bin(n)[2:])))
%o A175021     while n>=len(A.terms):
%o A175021        A.terms.append(next(k for k in count(A.terms[-1]+1)
%o A175021            if(s:=A.signature(k)) in A.rls or A.rls.add(s)))
%o A175021     return A.terms[n] # _M. F. Hasler_, Mar 11 2025
%Y A175021 Cf. A175020.
%K A175021 nonn,base
%O A175021 1,1
%A A175021 _Leroy Quet_, Nov 03 2009
%E A175021 Extended by _Ray Chandler_, Mar 11 2010