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.

Original entry on oeis.org

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, 19, 38, 77, 10, 21, 42, 85, 43, 87, 47, 94, 28, 25, 51, 102, 205, 155, 311, 111, 222, 29, 59, 119, 239, 31, 62, 60, 24, 16, 33, 66, 132, 264, 529, 35, 70, 140, 281, 50
Offset: 1

Views

Author

Ruud H.G. van Tol, Mar 16 2025

Keywords

Comments

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.
This sequence is a permutation of the natural numbers.

Examples

			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.
Juxtaposed numbers in binary, and positions within them, begin
  n = 1  2 3  4 5  6 7 8  ...
      1  1 0  1 1  1 0 0  ...
                \----/
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.
		

Crossrefs

Programs

  • PARI
    lista(n)= my(b=List(), i=0, s=0, m=Map(Mat([0, 0])), r=vector(n)); while(s
    				
  • Python
    from itertools import count, islice
    def bgen(): # generates concatenation of binary of digits of 1..oo
        yield from (b for i in count(1) for b in bin(i)[2:])
    def agen(): # generator of terms
        aset, s, g = set(), "", bgen()
        for n in count(1):
            s += next(g)
            an = next(i for k in range(1, n+1) if (i:=int(s[-k:], 2)) not in aset and i > 0)
            yield an
            aset.add(an)
    print(list(islice(agen(), 64))) # Michael S. Branicky, Mar 16 2025