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.

Showing 1-2 of 2 results.

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.

Original entry on oeis.org

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, -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, 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
Offset: 1

Views

Author

Attila Kiss, Aug 11 2023

Keywords

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.

Examples

			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, ...
		

Crossrefs

Programs

  • 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 *)
  • 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

Formula

a(n) = A365018(n) - A365017(n).

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

Original entry on oeis.org

0, 1, 3, 4, 5, 14, 15, 16, 17, 18, 20, 21, 22, 24, 25, 26, 27, 38, 39, 46, 47, 60, 61, 64, 65, 66, 68, 69, 70, 72, 73, 74, 80, 81, 82, 84, 85, 86, 88, 89, 90, 96, 97, 98, 100, 101, 104, 105, 106, 108, 109, 115, 119, 126, 127, 134, 135, 142, 143, 151, 156, 157, 158, 166, 167, 174
Offset: 1

Views

Author

Attila Kiss, Aug 16 2023

Keywords

Comments

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

Examples

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

Crossrefs

Programs

  • Mathematica
    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 *)
  • Python
    from itertools import islice
    def agen(): # generator of terms
        an, bins, concats = 0, {"0"}, 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
Showing 1-2 of 2 results.