login
Total number of distinct numbers that can be obtained by starting with 1 and applying the "Choix de Bruxelles", version 2 (A323460) operation at most n times.
6

%I #38 Jan 09 2025 13:00:48

%S 1,2,3,4,5,9,24,59,136,362,1365,5992,28187,135951,689058,3908456,

%T 24849118,171022869,1248075797

%N Total number of distinct numbers that can be obtained by starting with 1 and applying the "Choix de Bruxelles", version 2 (A323460) operation at most n times.

%C Equally, this is the total number of distinct numbers that can be obtained by starting with 1 and applying the "Choix de Bruxelles", version 1 (A323286) operation at most n times.

%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 Eric Angelini, Lars Blomberg, Charlie Neder, Remy Sigrist, and N. J. A. Sloane,, <a href="/A307635/a307635.pdf">"Choix de Bruxelles": A New Operation on Positive Integers</a>, Local copy.

%e After applying Choix de Bruxelles (version 1) twice to 1, we have seen the numbers {1,2,4}, so a(2)=3. After 5 applications, we have seen {1,2,4,8,16,13,26,32,112}, so a(5) = 9.

%o (Python)

%o from itertools import islice

%o def cdb2(n):

%o s, out = str(n), {n}

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

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

%o if s[i] == '0': continue

%o t = int(s[i:i+l])

%o out.add(int(s[:i] + str(2*t) + s[i+l:]))

%o if t&1 == 0: out.add(int(s[:i] + str(t//2) + s[i+l:]))

%o return out

%o def agen():

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

%o while True:

%o yield len(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(), 15))) # _Michael S. Branicky_, Jul 24 2022

%Y Cf. A323286, A323287, A323452 (first differences), A323453, A323460.

%K nonn,more,base

%O 0,2

%A _N. J. A. Sloane_, Jan 15 2019

%E a(7)-a(16) from _Rémy Sigrist_, Jan 15 2019

%E Deleted an incorrect comment. - _N. J. A. Sloane_, Jan 24 2019

%E a(17) from _Michael S. Branicky_, Jul 24 2022

%E a(18) from _Michael S. Branicky_, Jul 26 2022