cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A357891 a(1) = 1; a(n+1) is the smallest integer > 0 that cannot be obtained from the integers {a(1), ..., a(n)} using each number exactly once and the operators +, -, *, /.

This page as a plain text file.
%I A357891 #11 Nov 10 2022 12:35:59
%S A357891 1,2,4,11,34,152,1079,6610,93221
%N A357891 a(1) = 1; a(n+1) is the smallest integer > 0 that cannot be obtained from the integers {a(1), ..., a(n)} using each number exactly once and the operators +, -, *, /.
%o A357891 (Python)
%o A357891 from fractions import Fraction
%o A357891 def a(n, v):
%o A357891     R = dict() # index of each reachable subset is [card(s)-1][s]
%o A357891     for i in range(n): R[i] = dict()
%o A357891     for i in range(n): R[0][(v[i], )] = {v[i]}
%o A357891     #reach = set(v)
%o A357891     for j in range(1, n):
%o A357891         for i in range((j+1)//2):
%o A357891             for s1 in R[i]:
%o A357891                 for s2 in R[j-1-i]:
%o A357891                     if set(s1) & set(s2) == set():
%o A357891                         s12 = tuple(sorted(set(s1) | set(s2)))
%o A357891                         if s12 not in R[len(s12)-1]:
%o A357891                             R[len(s12)-1][s12] = set()
%o A357891                         for a in R[i][s1]:
%o A357891                             for b in R[j-1-i][s2]:
%o A357891                                 allowed = [a+b, a*b, a-b, b-a]
%o A357891                                 if a!=0: allowed.append(Fraction(b, a))
%o A357891                                 if b!=0: allowed.append(Fraction(a, b))
%o A357891                                 R[len(s12)-1][s12].update(allowed)
%o A357891     k = 1
%o A357891     while k in R[n-1][tuple(v)]: k += 1
%o A357891     return k
%o A357891 alst = [1]
%o A357891 [alst.append(a(n, alst)) for n in range(1, 6)]
%o A357891 print(alst) # _Michael S. Branicky_, Nov 01 2022
%Y A357891 Cf. A071115, A217043, A358075.
%K A357891 nonn,hard,more
%O A357891 1,2
%A A357891 _Rainer Rosenthal_ and _Hugo Pfoertner_, Nov 01 2022
%E A357891 a(9) from _Michael S. Branicky_, Nov 10 2022