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-1 of 1 results.

A356715 Total number of distinct numbers that can be obtained by starting with 1 and applying the "Choix de Bruxelles", version 2 operation at most n times in ternary (base 3).

Original entry on oeis.org

1, 2, 3, 6, 11, 26, 68, 177, 492, 1403, 4113, 12149, 36225, 108268, 324529, 973163, 2920533, 8764041, 26303715, 78935398, 236878491, 710783343
Offset: 0

Views

Author

J. Conrad, Aug 24 2022

Keywords

Examples

			For n = 2, a(2) = 3 since the numbers obtained are (in base 3): 1, 2, 11.
For n = 4, they expand to a(5) = 11 numbers (in base 3): 1, 2, 11, 12, 21, 22, 101, 111, 112, 121, 211.
		

Crossrefs

Cf. A323289 (decimal), A356511 (base 12)

Programs

  • Python
    # See Conrad link.
    
  • Python
    from itertools import islice
    from sympy.ntheory import digits
    def fd(d, b): return sum(b**i*di for i, di in enumerate(d[::-1]))
    def cdb2(n, base=3):
        d, out = digits(n, base)[1:], {n}
        for l in range(1, len(d)+1):
            for i in range(len(d)+1-l):
                if d[i] == 0: continue
                t = fd(d[i:i+l], base)
                out.add(fd(d[:i] + digits(2*t, base)[1:] + d[i+l:], base))
                if t&1 == 0:
                    out.add(fd(d[:i] + digits(t//2, base)[1:] + d[i+l:], base))
        return out
    def agen():
        reach, expand = {1}, [1]
        while True:
            yield len(reach) #; print(reach); print([digits(t, 3)[1:] for t in sorted(reach)])
            newreach = {r for q in expand for r in cdb2(q) if r not in reach}
            reach |= newreach
            expand = list(newreach)
    print(list(islice(agen(), 10))) # Michael S. Branicky, Aug 24 2022

Extensions

a(15)-a(19) from Michael S. Branicky, Aug 24 2022
a(20)-a(21) from Michael S. Branicky, Aug 30 2022
Showing 1-1 of 1 results.