OFFSET
1,5
COMMENTS
Empirical observation: the graph looks like hills in a repeating fractal-like pattern; each peak is about 1.4 times as high as the previous one.
LINKS
Attila Kiss, Table of n, a(n) for n = 1..17483.
Attila Kiss, Picture of the first ~17000 terms.
Attila Kiss, Java program to generate terms.
EXAMPLE
Sequence A: 0, 1, 3, 4, 5, 14, 15, 16, 17, 18, 20, 21, 22, ...
Sequence B: 1, 2, 3, 4, 8, 10, 13, 15, 16, 22, 23, 25, 30, ...
{a(n)}: 1, 1, 0, 0, 3, -4, -2, -1, -1, 4, 3, 4, 8, ...
MATHEMATICA
conc[x_, y_] := FromDigits[Flatten@IntegerDigits[{x, y}, 2], 2]; f[n_, m_] := f[n, m] = If[n == 1, m, Module[{k = f[n - 1, m] + 1, v = Array[f[#, m] &, n - 1], c}, c = conc @@@ Select[Tuples[v, {2}], UnsameQ @@ # &]; While[! FreeQ[c, k], k++]; k]]; a[n_] := f[n, 1] - f[n, 0]; Array[a, 80] (* Amiram Eldar, Sep 29 2023 *)
PROG
(Python)
from itertools import islice
def g(s=0): # helper generator for sequences A (s=0) and B (s=1)
cn, bins, concats = s, {bin(s)[2:]}, set()
while True:
yield cn
while (bn:=bin(cn:=cn+1)[2:]) in concats: pass
concats |= {bn+bi for bi in bins} | {bi+bn for bi in bins}
bins.add(bn)
def agen(): # generator of terms
A, B = g(s=0), g(s=1)
yield from (Bn - An for An, Bn in zip(A, B))
print(list(islice(agen(), 78))) # Michael S. Branicky, Nov 01 2023
CROSSREFS
KEYWORD
AUTHOR
Attila Kiss, Aug 11 2023
STATUS
approved