%I #31 Apr 09 2022 06:39:00
%S 0,11,1,10,100,111,1000,101,110,1001,1010,1100,1111,10000,1011,1101,
%T 1110,10001,10010,10100,10111,11000,11011,11101,11110,100000,10011,
%U 10101,10110,11001,11010,11100,11111,100001,100010,100100,100111,101000,101011,101101,101110,110000,110011,110101,110110,111001
%N Working in base 2: a(0)=0, thereafter a(n+1) is the smallest number not already in the sequence such that the bits of a(n) and a(n+1) together can be rearranged to form a palindrome.
%C A binary version of A228407.
%C The palindrome must be a proper binary number, i.e. must begin with 1 (if it is > 0). Also, the union of the bits of a(n) and a(n+1) cannot contain both an odd number of 0's and an odd number of 1's.
%C Just as for A228407, we can ask: does every number appear? The answer is yes - see the Comments in A228407.
%H Chai Wah Wu, <a href="/A230891/b230891.txt">Table of n, a(n) for n = 0..30000</a> (terms 0..1024 from Robert G. Wilson v).
%t a[0] = 0; a[n_] := a[n] = Block[{k = 1, idm = IntegerDigits[ a[n - 1], 2], t = a@# & /@ Range[n - 1]}, Label[ start]; While[ MemberQ[t, k], k++]; While[ Select[ Permutations[ Join[idm, IntegerDigits[k, 2]]], #[[1]] != 0 && # == Reverse@# &] == {}, k++; Goto[start]]; k]; s = Array[a, 46, 0]; FromDigits@# & /@ IntegerDigits[s, 2] (* _Robert G. Wilson v_, Dec 31 2013 *)
%o (Python)
%o from collections import Counter
%o A230891_list, l, s, b = [0, 11], Counter('11'), 1, {3}
%o for _ in range(30001):
%o i = s
%o while True:
%o if i not in b:
%o li, o = Counter(bin(i)[2:]), 0
%o for d in (l+li).values():
%o if d % 2:
%o if o > 0:
%o break
%o o += 1
%o else:
%o A230891_list.append(int(bin(i)[2:]))
%o l = li
%o b.add(i)
%o while s in b:
%o b.remove(s)
%o s += 1
%o break
%o i += 1 # _Chai Wah Wu_, Jun 19 2016
%Y Cf. A228407, A230892 (these numbers written in base 10).
%K nonn,base
%O 0,2
%A _N. J. A. Sloane_, Nov 11 2013