%I #11 Jan 22 2021 14:18:42
%S 0,1,1,2,1,3,2,4,1,5,3,6,2,6,4,7,1,8,5,9,3,10,6,11,2,9,6,12,4,11,7,13,
%T 1,14,8,15,5,16,9,17,3,16,10,18,6,19,11,20,2,15,9,21,6,18,12,22,4,17,
%U 11,22,7,20,13,23,1,24,14,25,8,26,15,27,5,28,16
%N Lexicographically earliest sequence of nonnegative integers with as many distinct values as possible such that for any n >= 0, a(rev(n)) = a(n) (where rev(n) = A030101(n) corresponds to the binary reversal of n).
%C The condition "with as many distinct values as possible" means here that for any distinct m and n, provided the orbits of m and n under the map x -> rev(x) do not merge, then a(m) <> a(n).
%H Rémy Sigrist, <a href="/A340717/b340717.txt">Table of n, a(n) for n = 0..8191</a>
%H Rémy Sigrist, <a href="/A340717/a340717.png">Colored scatterplot of the first 2^16 terms</a> (where the color is function of A007814(n), the 2-adic valuation of n)
%H Rémy Sigrist, <a href="/A340717/a340717.gp.txt">PARI program for A340717</a>
%F a(2*n) = a(n).
%F a(n) = 1 iff n is a power of 2.
%F a(n) = 2 iff n belongs to A007283.
%F a(n) = 3 iff n belongs to A020714.
%F a(n) = 4 iff n belongs to A005009.
%F a(n) = 5 iff n belongs to A005010.
%F a(A340718(n)) = n (and this is the first occurrence of n in the sequence).
%e The first terms, alongside rev(n), are:
%e n a(n) rev(n)
%e -- ---- ------
%e 0 0 0
%e 1 1 1
%e 2 1 1
%e 3 2 3
%e 4 1 1
%e 5 3 5
%e 6 2 3
%e 7 4 7
%e 8 1 1
%e 9 5 9
%e 10 3 5
%e 11 6 13
%e 12 2 3
%e 13 6 11
%e 14 4 7
%e 15 7 15
%o (PARI) See Links section.
%Y See A340716 for similar sequences.
%Y Cf. A000079, A005009, A005010, A007283, A007814, A020714, A030101, A340718.
%K nonn,look,base
%O 0,4
%A _Rémy Sigrist_, Jan 17 2021