A365018 a(n) is the least positive integer not already in the sequence whose binary expansion is not the concatenation of any two earlier terms.
1, 2, 3, 4, 8, 10, 13, 15, 16, 22, 23, 25, 30, 32, 36, 37, 38, 39, 41, 44, 46, 49, 50, 52, 53, 59, 60, 64, 69, 70, 71, 76, 78, 81, 82, 85, 88, 92, 97, 98, 104, 106, 109, 111, 115, 120, 125, 127, 128, 133, 134, 135, 136, 137, 140, 142, 145, 148, 149, 152, 156, 161, 162, 170, 176, 182
Offset: 1
Examples
5 is not a term since its binary expansion is "101", which is the concatenation of earlier a(2)="10" and a(1)="1". 19 is not a term since its binary expansion is "10011", which is the concatenation of a(4)="100" and a(3)="11".
Links
- Attila Kiss, Java code to generate terms.
Programs
-
Mathematica
conc[x_, y_] := FromDigits[Flatten@IntegerDigits[{x, y}, 2], 2]; a[1] = 1; 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 *)
-
Python
from itertools import islice def agen(): # generator of terms an, bins, concats = 1, {"1"}, set() while True: yield an while (bn:=bin(an:=an+1)[2:]) in concats: pass concats |= {bn+bi for bi in bins} | {bi+bn for bi in bins} bins.add(bn) print(list(islice(agen(),62))) # Michael S. Branicky, Sep 29 2023
Comments