login
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.
1
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,2
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.
EXAMPLE
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.
PROG
(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;
(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
CROSSREFS
Sequence in context: A257905 A379657 A305878 * A093924 A130597 A387365
KEYWORD
nonn,base
AUTHOR
Ruud H.G. van Tol, Mar 16 2025
STATUS
approved