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”).

A371343
Lexicographically latest sequence of distinct nonnegative integers such that for any n >= 0, the binary expansions of n and of a(n) have the same length (A070939) and the same number of runs of consecutive equals digits (A005811).
1
0, 1, 2, 3, 6, 5, 4, 7, 14, 13, 10, 11, 12, 9, 8, 15, 30, 29, 26, 27, 22, 21, 20, 25, 28, 23, 18, 19, 24, 17, 16, 31, 62, 61, 58, 59, 54, 53, 52, 57, 50, 45, 42, 43, 46, 41, 44, 55, 60, 51, 40, 49, 38, 37, 36, 47, 56, 39, 34, 35, 48, 33, 32, 63, 126, 125, 122
OFFSET
0,3
COMMENTS
This sequence is a self-inverse permutation of the nonnegative integers with infinitely many fixed points (for example, all terms of A000225 are fixed points).
EXAMPLE
The first terms, in decimal and in binary, are:
n a(n) bin(n) bin(a(n))
-- ---- ------ ---------
0 0
1 1 1 1
2 2 10 10
3 3 11 11
4 6 100 110
5 5 101 101
6 4 110 100
7 7 111 111
8 14 1000 1110
9 13 1001 1101
10 10 1010 1010
11 11 1011 1011
12 12 1100 1100
13 9 1101 1001
14 8 1110 1000
15 15 1111 1111
PROG
(PARI) \\ See Links section.
CROSSREFS
See A331274 and A337242 for similar sequences.
Sequence in context: A175949 A166404 A337242 * A166166 A106452 A254118
KEYWORD
nonn,base
AUTHOR
Rémy Sigrist, Mar 24 2024
STATUS
approved