|
|
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).
|
|
0
|
|
|
1, 2, 3, 6, 11, 26, 68, 177, 492, 1403, 4113, 12149, 36225, 108268, 324529, 973163, 2920533, 8764041, 26303715, 78935398, 236878491, 710783343
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
OFFSET
|
0,2
|
|
LINKS
|
|
|
EXAMPLE
|
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.
|
|
PROG
|
(Python) See links
(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)
|
|
CROSSREFS
|
|
|
KEYWORD
|
nonn,base,more
|
|
AUTHOR
|
|
|
EXTENSIONS
|
|
|
STATUS
|
approved
|
|
|
|