login
a(n) is the least nonnegative integer not already in the sequence whose binary expansion is not the concatenation of any two earlier terms.
2

%I #46 Nov 05 2023 15:00:13

%S 0,1,3,4,5,14,15,16,17,18,20,21,22,24,25,26,27,38,39,46,47,60,61,64,

%T 65,66,68,69,70,72,73,74,80,81,82,84,85,86,88,89,90,96,97,98,100,101,

%U 104,105,106,108,109,115,119,126,127,134,135,142,143,151,156,157,158,166,167,174

%N a(n) is the least nonnegative integer not already in the sequence whose binary expansion is not the concatenation of any two earlier terms.

%C a(1)=0 is taken to be a single 0 bit when concatenating.

%H Attila Kiss, <a href="/A365017/a365017.java.txt">Java code to generate terms</a>.

%e The number 2 is excluded because its binary expansion is "10", which is the concatenation of a(1)="1" and a(0)="0".

%e The number 19 is excluded because its binary expansion is "10011", which is the concatenation of a(4)="100" and a(3)="11".

%t conc[x_, y_] := FromDigits[Flatten@IntegerDigits[{x, y}, 2], 2]; a[1] = 0; a[n_] := a[n] = Module[{k = a[n - 1] + 1, v = Array[a, n - 1], c}, c = conc @@@ Select[Tuples[v, {2}], UnsameQ @@ # &]; While[! FreeQ[c, k], k++]; k]; Array[a, 60] (* _Amiram Eldar_, Sep 29 2023 *)

%o (Python)

%o from itertools import islice

%o def agen(): # generator of terms

%o an, bins, concats = 0, {"0"}, set()

%o while True:

%o yield an

%o while (bn:=bin(an:=an+1)[2:]) in concats: pass

%o concats |= {bn+bi for bi in bins} | {bi+bn for bi in bins}

%o bins.add(bn)

%o print(list(islice(agen(),62))) # _Michael S. Branicky_, Sep 29 2023

%Y Cf. A365018, A364871.

%K nonn,base

%O 1,3

%A _Attila Kiss_, Aug 16 2023