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.

A382453 Lexicographically earliest sequence of distinct terms such that no term is a substring of the sum of any two terms.

This page as a plain text file.
%I A382453 #8 Mar 26 2025 21:47:47
%S A382453 1,3,21,23,25,39,41,43,45,47,49,221,223,241,243,2001,2003,2021,2023,
%T A382453 2025,2039,2041,2043,2045,2047,2049,2221,2223,2241,2243,2601,2603,
%U A382453 2621,2623,2639,2641,2643,2645,4001,4003,4021,4023,4025,4039,4041,4043,4045,4047
%N A382453 Lexicographically earliest sequence of distinct terms such that no term is a substring of the sum of any two terms.
%C A382453 The "two terms" mentioned in the name are not necessarily distinct, so no term is the substring of the double of any term.
%C A382453 The first digit of every term is less than 5.
%e A382453 For calculating a(3):
%e A382453 If 4 was in the sequence, 1+3 = 4 would have 4, itself, as a substring, so it is disallowed.
%e A382453 If 5 was in the sequence, 5+5 = 10 would have 1 as a substring, so it is disallowed.
%e A382453 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.
%e A382453 So, a(3) = 21.
%o A382453 (Python)
%o A382453 a = [1]
%o A382453 while len(a) < 20:
%o A382453     a.append(a[-1]+1)
%o A382453     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
%o A382453 print(a)
%o A382453 (Python)
%o A382453 from itertools import count, islice
%o A382453 def agen():    # generator of terms
%o A382453     slst, alst, an = [], [], 1
%o A382453     S = ["2"]  # strings of sums of two terms (including self sums)
%o A382453     while True:
%o A382453         alst.append(an)
%o A382453         slst.append(str(an))
%o A382453         yield an
%o A382453         for k in count(an+1):
%o A382453             sk = str(k)
%o A382453             if any(sk in s for s in S): continue
%o A382453             Pk = [str(ai+k) for ai in alst] + [str(k+k)]
%o A382453             if any(si in s for s in Pk for si in slst+[sk]): continue
%o A382453             an = k
%o A382453             S += Pk
%o A382453             break
%o A382453 print(list(islice(agen(), 48))) # _Michael S. Branicky_, Mar 26 2025
%Y A382453 Cf. A381242.
%K A382453 nonn,base
%O A382453 1,2
%A A382453 _Dominic McCarty_, Mar 26 2025