login
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).
0

%I #22 May 17 2023 10:40:18

%S 1,2,3,6,11,26,68,177,492,1403,4113,12149,36225,108268,324529,973163,

%T 2920533,8764041,26303715,78935398,236878491,710783343

%N 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).

%H Eric Angelini, Lars Blomberg, Charlie Neder, Remy Sigrist, and N. J. A. Sloane, <a href="http://arxiv.org/abs/1902.01444">"Choix de Bruxelles": A New Operation on Positive Integers</a>, arXiv:1902.01444 [math.NT], Feb 2019; Fib. Quart. 57:3 (2019), 195-200.

%H J. Conrad, <a href="https://raw.githubusercontent.com/cxr00/cxr/master/tests/base64/choix_de_bruxelles.py">Python program</a>.

%e For n = 2, a(2) = 3 since the numbers obtained are (in base 3): 1, 2, 11.

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

%o (Python) See links

%o (Python)

%o from itertools import islice

%o from sympy.ntheory import digits

%o def fd(d, b): return sum(b**i*di for i, di in enumerate(d[::-1]))

%o def cdb2(n, base=3):

%o d, out = digits(n, base)[1:], {n}

%o for l in range(1, len(d)+1):

%o for i in range(len(d)+1-l):

%o if d[i] == 0: continue

%o t = fd(d[i:i+l], base)

%o out.add(fd(d[:i] + digits(2*t, base)[1:] + d[i+l:], base))

%o if t&1 == 0:

%o out.add(fd(d[:i] + digits(t//2, base)[1:] + d[i+l:], base))

%o return out

%o def agen():

%o reach, expand = {1}, [1]

%o while True:

%o yield len(reach) #; print(reach); print([digits(t, 3)[1:] for t in sorted(reach)])

%o newreach = {r for q in expand for r in cdb2(q) if r not in reach}

%o reach |= newreach

%o expand = list(newreach)

%o print(list(islice(agen(), 10))) # _Michael S. Branicky_, Aug 24 2022

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

%K nonn,base,more

%O 0,2

%A _J. Conrad_, Aug 24 2022

%E a(15)-a(19) from _Michael S. Branicky_, Aug 24 2022

%E a(20)-a(21) from _Michael S. Branicky_, Aug 30 2022