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.

A382115 a(n) is the smallest positive number not already used and whose binary expansion occurs, ending at position n, in the binary Champernowne word.

This page as a plain text file.
%I A382115 #34 Mar 27 2025 20:28:32
%S A382115 1,3,2,5,11,7,6,4,9,18,37,75,23,14,13,27,55,15,30,12,8,17,34,68,137,
%T A382115 19,38,77,10,21,42,85,43,87,47,94,28,25,51,102,205,155,311,111,222,29,
%U A382115 59,119,239,31,62,60,24,16,33,66,132,264,529,35,70,140,281,50
%N A382115 a(n) is the smallest positive number not already used and whose binary expansion occurs, ending at position n, in the binary Champernowne word.
%C A382115 In other words, distinct positive numbers in base-10 from the digits n-k to n from the juxtaposition of the positive binary numbers, with k >= 0 minimal.
%C A382115 This sequence is a permutation of the natural numbers.
%H A382115 Ruud H.G. van Tol, <a href="/A382115/b382115.txt">Table of n, a(n) for n = 1..10000</a>
%H A382115 <a href="/index/Per#IntegerPermutation">Index entries for sequences that are a permutation of the natural numbers</a>
%H A382115 <a href="/index/Bi#binary">Index entries for sequences related to binary expansion of n</a>
%e A382115 From the juxtaposition 1.10.11.100.101.110.111.1000..., a(1) uses digits 1 to 1, a(2) uses digits 1 to 2, a(3) uses digits 2 to 3 and a(4) uses digits 2 to 4.
%e A382115 Juxtaposed numbers in binary, and positions within them, begin
%e A382115   n = 1  2 3  4 5  6 7 8  ...
%e A382115       1  1 0  1 1  1 0 0  ...
%e A382115                 \----/
%e A382115 For n=7, binary 10 = 2 ends at n=7 but has already appeared at a(3)=2, and the next smallest binary 110 = 6 has not yet appeared so a(7) = 6.
%o A382115 (PARI) lista(n)= my(b=List(), i=0, s=0, m=Map(Mat([0, 0])), r=vector(n)); while(s<n, listput(~b, binary(i++)); s+=#b[#b]); b=concat(b); for(j=1, n, forstep(i=j, 1, -1, my(a=fromdigits(b[i..j], 2)); if(!mapisdefined(m, a), r[j]=a; mapput(~m, a, 0); break))); r;
%o A382115 (Python)
%o A382115 from itertools import count, islice
%o A382115 def bgen(): # generates concatenation of binary of digits of 1..oo
%o A382115     yield from (b for i in count(1) for b in bin(i)[2:])
%o A382115 def agen(): # generator of terms
%o A382115     aset, s, g = set(), "", bgen()
%o A382115     for n in count(1):
%o A382115         s += next(g)
%o A382115         an = next(i for k in range(1, n+1) if (i:=int(s[-k:], 2)) not in aset and i > 0)
%o A382115         yield an
%o A382115         aset.add(an)
%o A382115 print(list(islice(agen(), 64))) # _Michael S. Branicky_, Mar 16 2025
%Y A382115 Cf. A030190, A083652.
%K A382115 nonn,base
%O A382115 1,2
%A A382115 _Ruud H.G. van Tol_, Mar 16 2025