login
a(n) is the smallest positive integer that cannot be obtained using at most n-1 of the integers {1, 2, ..., n} using each number at most once and the operators +, -, *, /.
0

%I #12 Dec 29 2022 06:46:29

%S 1,3,7,17,47,158,681,3209,17989,104289,635867

%N a(n) is the smallest positive integer that cannot be obtained using at most n-1 of the integers {1, 2, ..., n} using each number at most once and the operators +, -, *, /.

%C For all n>=2, A060315(n+1) > a(n) > A060315(n).

%H Gilles Bannay, <a href="https://web.archive.org/web/20061201125224/http://gilles.bannay.free.fr/jeux_us.html">Countdown Problem</a>

%H <a href="/index/Fo#4x4">Index entries for similar sequences</a>

%e a(3)=7 because using two of the numbers {1,2,3} with the four operations we can obtain 1=1, 2=2, 3=3, 3+1=4, 3+2=5, 3*2=6 but we cannot obtain 7 in the same way.

%o (Python)

%o def a(n):

%o R = dict() # index of each reachable subset is [card(s)-1][s]

%o for i in range(n): R[i] = dict()

%o for i in range(1, n+1): R[0][(i,)] = {i}

%o reach = set(i for i in range(1, n+1)) if n > 1 else set()

%o for j in range(1, n-1):

%o for i in range((j+1)//2):

%o for s1 in R[i]:

%o for s2 in R[j-1-i]:

%o if set(s1) & set(s2) == set():

%o s12 = tuple(sorted(set(s1) | set(s2)))

%o if s12 not in R[len(s12)-1]:

%o R[len(s12)-1][s12] = set()

%o for a in R[i][s1]:

%o for b in R[j-1-i][s2]:

%o allowed = [a+b, a*b, a-b, b-a]

%o if a!=0 and b%a==0: allowed.append(b//a)

%o if b!=0 and a%b==0: allowed.append(a//b)

%o R[len(s12)-1][s12].update(allowed)

%o reach.update(allowed)

%o k = 1

%o while k in reach: k += 1

%o return k

%o print([a(n) for n in range(1, 6)]) # _Michael S. Branicky_, Jul 29 2022

%Y Cf. A060315.

%K hard,more,nonn

%O 1,2

%A Koksal Karakus (karakusk(AT)hotmail.com), Jun 17 2002

%E a(11) from _Michael S. Branicky_, Jul 29 2022