login
For any number with binary expansion (b_1, ..., b_w), replace the i-th "1" by b_{w+1-i} for i = 1..A000120(n) and the j-th "0" by b_j for j = 1..A023416(n); the resulting binary expansion is that of a(n).
2

%I #10 May 11 2020 02:27:20

%S 0,1,1,3,2,6,3,7,4,12,6,14,3,11,7,15,8,24,10,26,9,25,14,30,6,22,13,29,

%T 7,23,15,31,16,48,18,50,17,49,22,54,18,50,25,57,21,53,30,62,12,44,28,

%U 60,14,46,29,61,7,39,23,55,15,47,31,63,32,96,34,98,33

%N For any number with binary expansion (b_1, ..., b_w), replace the i-th "1" by b_{w+1-i} for i = 1..A000120(n) and the j-th "0" by b_j for j = 1..A023416(n); the resulting binary expansion is that of a(n).

%C Fixed points correspond to A000225.

%H Rémy Sigrist, <a href="/A334667/b334667.txt">Table of n, a(n) for n = 0..8191</a>

%H <a href="/index/Bi#binary">Index entries for sequences related to binary expansion of n</a>

%F A000120(a(n)) = A000120(n).

%e For n = 41:

%e - the binary representation of 41 is "101001",

%e - the 3 1's are replaced by 1, 0, 0, respectively,

%e - the 3 0's are replaced by 1, 0, 1, respectively,

%e - hence we obtain "110010",

%e - and a(41) = 50.

%o (PARI) a(n) = { my (b=binary(n), t=vector(#b), l=0, r=#b+1); for (k=1, #b, t[k] = if (!b[k], b[l++], b[r--])); fromdigits(t, 2) }

%Y See A334666 for a similar sequence.

%Y Cf. A000120, A000225, A023416.

%K nonn,base

%O 0,4

%A _Rémy Sigrist_, May 08 2020