login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

A308093
For any n > 0, let f_n be the lexicographically earliest sequence of distinct positive terms such that the concatenation of the binary representation of its terms, without leading zeros, corresponds to the binary representation of n repeated indefinitely. Apparently, n always appears in f_n. a(n) gives the index of n in f_n.
1
1, 1, 2, 1, 3, 3, 3, 1, 3, 2, 8, 3, 8, 5, 4, 1, 3, 3, 8, 3, 5, 8, 15, 3, 8, 8, 15, 5, 10, 7, 5, 1, 3, 3, 8, 2, 7, 7, 15, 3, 7, 3, 9, 7, 7, 15, 28, 3, 8, 7, 15, 7, 15, 7, 24, 5, 10, 9, 17, 7, 11, 9, 6, 1, 3, 3, 8, 3, 7, 7, 15, 3, 5, 8, 14, 8, 14, 11, 28, 3, 7
OFFSET
1,3
COMMENTS
In other words, f_n(a(n)) = n.
LINKS
FORMULA
a(2^k) = 1 for any k >= 0.
a(2^k-1) = k for any k > 0.
a(n) = 2 iff n = A007582(k) for some k > 0.
EXAMPLE
The first terms, alongside the binary representations of n and the first terms of f_n, are:
n a(n) bin(n) bin(f_n)
-- ---- ------ -----------------------------------------
1 1 1 1,...
2 1 10 10,...
3 2 11 1,11,...
4 1 100 100,...
5 3 101 10,1,101,...
6 3 110 1,10,110,...
7 3 111 1,11,111,...
8 1 1000 1000,...
9 3 1001 100,1,1001,...
10 2 1010 10,1010,...
11 8 1011 10,1,110,11,101,1101,11011,1011,...
12 3 1100 1,100,1100,...
13 8 1101 1,10,11,101,110,1110,11101,1101,...
14 5 1110 1,110,11,10,1110,...
15 4 1111 1,11,111,1111,...
16 1 10000 10000,...
17 3 10001 1000,1,10001,...
18 3 10010 100,10,10010,...
19 8 10011 100,1,1100,11,1001,11001,110011,10011,...
20 3 10100 10,100,10100,...
PROG
(PARI) See Links section.
CROSSREFS
Cf. A007582.
Sequence in context: A333224 A124770 A334300 * A264154 A302641 A099246
KEYWORD
nonn,base
AUTHOR
Rémy Sigrist, May 12 2019
STATUS
approved