A382453 Lexicographically earliest sequence of distinct terms such that no term is a substring of the sum of any two terms.
1, 3, 21, 23, 25, 39, 41, 43, 45, 47, 49, 221, 223, 241, 243, 2001, 2003, 2021, 2023, 2025, 2039, 2041, 2043, 2045, 2047, 2049, 2221, 2223, 2241, 2243, 2601, 2603, 2621, 2623, 2639, 2641, 2643, 2645, 4001, 4003, 4021, 4023, 4025, 4039, 4041, 4043, 4045, 4047
Offset: 1
Examples
For calculating a(3): If 4 was in the sequence, 1+3 = 4 would have 4, itself, as a substring, so it is disallowed. If 5 was in the sequence, 5+5 = 10 would have 1 as a substring, so it is disallowed. The first term that is allowed is 21, since 21 is the first term not to have 1, 3, or itself as a substring of any of the following: 1+21 = 22, 3+21 = 24, 21+21 = 42. So, a(3) = 21.
Crossrefs
Cf. A381242.
Programs
-
Python
a = [1] while len(a) < 20: a.append(a[-1]+1) while any(any(str(k) in str(a[i]+a[j]) for k in a) for i in range(len(a)) for j in range(i,len(a))): a[-1] += 1 print(a)
-
Python
from itertools import count, islice def agen(): # generator of terms slst, alst, an = [], [], 1 S = ["2"] # strings of sums of two terms (including self sums) while True: alst.append(an) slst.append(str(an)) yield an for k in count(an+1): sk = str(k) if any(sk in s for s in S): continue Pk = [str(ai+k) for ai in alst] + [str(k+k)] if any(si in s for s in Pk for si in slst+[sk]): continue an = k S += Pk break print(list(islice(agen(), 48))) # Michael S. Branicky, Mar 26 2025
Comments