cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A364871 a(n) = B(n) - A(n), where A(1) = 0, B(1) = 1, and sequences A and B are the lexicographically earliest sequences that start with their respective first terms and contain no term whose binary expansion is the concatenation of any two earlier terms in that sequence.

This page as a plain text file.
%I A364871 #33 Nov 01 2023 22:00:53
%S A364871 1,1,0,0,3,-4,-2,-1,-1,4,3,4,8,8,11,11,11,1,2,-2,-1,-11,-11,-12,-12,
%T A364871 -7,-8,-5,-1,-2,-2,2,-2,0,0,1,3,6,9,9,14,10,12,13,15,19,21,22,22,25,
%U A364871 25,20,17,11,13,8,10,6,6,1,0,4,4,4,9,8,8,1,1,1,1,-6,-12,-11,-15,-21,-18,-20
%N A364871 a(n) = B(n) - A(n), where A(1) = 0, B(1) = 1, and sequences A and B are the lexicographically earliest sequences that start with their respective first terms and contain no term whose binary expansion is the concatenation of any two earlier terms in that sequence.
%C A364871 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.
%H A364871 Attila Kiss, <a href="/A364871/b364871.txt">Table of n, a(n) for n = 1..17483</a>.
%H A364871 Attila Kiss, <a href="/A364871/a364871.jpg">Picture of the first ~17000 terms</a>.
%H A364871 Attila Kiss, <a href="/A364871/a364871.java.txt">Java program to generate terms</a>.
%F A364871 a(n) = A365018(n) - A365017(n).
%e A364871 Sequence A: 0, 1, 3, 4, 5, 14, 15, 16, 17, 18, 20, 21, 22, ...
%e A364871 Sequence B: 1, 2, 3, 4, 8, 10, 13, 15, 16, 22, 23, 25, 30, ...
%e A364871     {a(n)}: 1, 1, 0, 0, 3, -4, -2, -1, -1,  4,  3,  4,  8, ...
%t A364871 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 *)
%o A364871 (Python)
%o A364871 from itertools import islice
%o A364871 def g(s=0): # helper generator for sequences A (s=0) and B (s=1)
%o A364871     cn, bins, concats = s, {bin(s)[2:]}, set()
%o A364871     while True:
%o A364871         yield cn
%o A364871         while (bn:=bin(cn:=cn+1)[2:]) in concats: pass
%o A364871         concats |= {bn+bi for bi in bins} | {bi+bn for bi in bins}
%o A364871         bins.add(bn)
%o A364871 def agen(): # generator of terms
%o A364871     A, B = g(s=0), g(s=1)
%o A364871     yield from (Bn - An for An, Bn in zip(A, B))
%o A364871 print(list(islice(agen(), 78))) # _Michael S. Branicky_, Nov 01 2023
%Y A364871 Cf. A365017, A365018.
%K A364871 sign,base,look
%O A364871 1,5
%A A364871 _Attila Kiss_, Aug 11 2023