%I #12 Aug 21 2017 22:09:51
%S 1,0,1,1,1,0,0,1,0,0,0,1,0,1,0,1,1,1,0,1,0,0,1,1,1,1,1,1,0,0,0,0,1,0,
%T 1,1,0,1,0,0,0,1,1,1,1,0,1,1,0,0,0,0,0,1,1,1,0,0,0,1,0,0,1,0,0,1,0,1,
%U 1,0,0,1,1,1,0,1,0,1,0,0,1,1,0,1,0,1,1,0,1,1,1,1,0,1,1,1,0,0,0,0,0,0,1,0,1
%N a(1)=1. Concatenate onto the end of the sequence (from left to right) the integer m_n converted into binary and reversed (with the most significant digit on the right), where m_n is the smallest integer > A118252(n-1) and whose reversed binary representation does not occur anywhere earlier in the sequence (when the concatenated sequence is read from left to right). A118252(n) then equals m_n when written in decimal.
%H Michael De Vlieger, <a href="/A118251/b118251.txt">Table of n, a(n) for n = 1..11424</a> (Contains the reversed binary values of the first 1000 terms of A118252.)
%e The sequence begins 1,0,1,1,1,0,0,1,0,0,0,1,0,1,0,1,1,1,0,1,0,0,1,1. Now A118252(8) = 12, which is represented by the 0,0,1,1 at the end of the sequence. The binary representation of 13 (1011 in binary and reversed) and 14 (0111 in binary and reversed) both occur earlier in the sequence. But the binary representation of 15 (1111 in binary and reversed) does not occur earlier in the sequence, so (1,1,1,1) is added to the end of the sequence. And A118252(9) becomes 15.
%t a = {1}; b = {1}; Do[k = b[[i - 1]] + 1; While[SequenceCount[Flatten@ a, Set[d, Reverse@ IntegerDigits[k, 2]]] != 0, k++]; a = Join[a, d]; AppendTo[b, k], {i, 2, 23}]; a (* _Michael De Vlieger_, Aug 21 2017 *)
%Y Cf. A118247, A118249, A118252.
%K easy,nonn,base
%O 1,1
%A _Leroy Quet_, Apr 18 2006
%E More terms from _Joshua Zucker_, Jul 27 2006