OFFSET
1,4
COMMENTS
EXAMPLE
For n = 10, the a(10) = 7 terminal states are: [4, 3, 2, 1], [5, 3, 2], [5, 4, 1], [6, 3, 1], [6, 4], [7, 2, 1], and [8, 2].
The algorithm does not reach the other four possible terminal states: [5, 5], [7, 3], [9, 1], and [10].
PROG
(Python)
def A292728(n):
....s_todo, s_done = set([(1, )*n]), set()
....count=0
....while len(s_todo) > 0:
........s_new = set()
........for s in s_todo:
............last = -1 ; idx = 0 ; final = True
............while (idx+1) < len(s):
................h = s[idx]
................if h!=last and s[idx+1]==h:
....................final = False
....................for q in range(1, h+1):
........................lst = list(s[:idx]) + list(s[idx+2:])
........................lst += [2*h] if h==q else [ h-q, h+q]
........................t = tuple(sorted(lst))
........................if (not t in s_todo and
............................not t in s_new and
............................not t in s_done):
............................s_new.add(t)
................last = s[idx] ; idx += 1
............if final: count += 1
........s_done.update(s_todo) ; s_todo = s_new
....return count
# Bert Dobbelaere, Jul 14 2019
CROSSREFS
KEYWORD
nonn
AUTHOR
Peter Kagey, Sep 21 2017
EXTENSIONS
a(49)-a(60) from Bert Dobbelaere, Jul 14 2019
STATUS
approved