reviewed
reviewed
proposed
editing
From Emeric Deutsch, Oct 06 2020 (Start)
approved
editing
a(12) = 9, because 12 = 1100_2 and 1100_2 XOR 0101_2 = 1001_2 = 9.
a(0) = 0, and for n>=1, let b(n,m) be the m-th digit, reading left to right, of binary n. (b(n, 1) is the most significant binary digit, which is 1.) Then a(n) is such that b(a(n),1)=1; and if b(n,m)=b(n,m-1) then b(a(n),m) does not = b(a(n),m-1); and if b(n,m) does not = b(n,m-1) then b(a(n), m) = b(a(n),m-1), for all m where 2 <= m <= number binary digits in n.
a(n) is obtained by flipping every second bit in the binary representation of n starting at the second-most significant bit and on downwards. - Kevin Ryde, Oct 07 2020
12 in binary is 1100. Generating a(12): the leftmost binary digit is 1. In 1100, the 2nd digit from the left equals the first, so the second digit from the left of binary a(12) does not equal the first; so we have 10 as the two leftmost digits in binary a(12). The third digit from the left of binary 12 does not equal the second, so the third digit from the left of binary a(12) equals the second; therefore the leftmost 3 digits of a(12) in binary are 100. And finally, the rightmost digit of binary 12 equals the 3rd from the left, so the rightmost digit of binary a(12) does not equal the 3rd from the left of binary a(12). Therefore a(12) in binary is 1001. And a(12) is the decimal equivalent of this, which is 9.