%I #17 Nov 15 2025 16:10:38
%S 1,2,4,7,10,13,18,21,24,27,30,33,38,41,44,47,50,53,58,61,64,67,73,78,
%T 81,87,90,93,98,101,104,107,110,113,118,121,124,127,133,138,141,144,
%U 149,155,158,161,172,175,178,181,184,192,195,198,201,204,209,215,218,221,224,229,235
%N Least positive integer not the sum, product or power of any previous pair of distinct terms.
%H Michael S. Branicky, <a href="/A390396/b390396.txt">Table of n, a(n) for n = 1..10000</a>
%F a(n+1) > a(n) for all n > 1 since 1 is a term and hence a(n) is in the set of products and a(n+1) >= a(n) by construction. - _Michael S. Branicky_, Nov 13 2025
%o (Python)
%o from itertools import combinations
%o def generate_sequence(n_terms):
%o sequence = [1]
%o while len(sequence) < n_terms:
%o sums = set()
%o prods = set()
%o powers = set()
%o for a, b in combinations(sequence, 2):
%o sums.add(a + b)
%o prods.add(a * b)
%o try:
%o powers.add(a ** b)
%o except OverflowError:
%o pass
%o try:
%o powers.add(b ** a)
%o except OverflowError:
%o pass
%o forbidden = sums.union(prods).union(powers)
%o candidate = 1
%o while candidate in sequence or candidate in forbidden:
%o candidate += 1
%o sequence.append(candidate)
%o return sequence
%o seq = generate_sequence(15)
%o (Python)
%o from math import isqrt
%o from itertools import count
%o def aupto(limit):
%o alst, an, aset, sums, prds, pows, r = [], 1, {1}, {1}, {1}, set(), isqrt(limit)+1
%o while an <= limit:
%o alst.append(an)
%o aset.add(an)
%o an = next(k for k in count(an+1) if all(k not in S for S in [sums, prds, pows]))
%o sums |= {t for s in aset if (t:= an+s) <= limit}
%o prds |= {t for p in aset if (t:= an*p) <= limit}
%o for p in aset:
%o if an > r or (t:=an**p) > limit: break
%o pows.add(t)
%o for p in aset:
%o if p > r or (t:=p**an) > limit: break
%o pows.add(t)
%o return alst
%o print(aupto(300)) # _Michael S. Branicky_, Nov 08 2025
%Y Cf. A066512.
%K nonn
%O 1,2
%A _Marc Morgenegg_, Nov 04 2025