A370264 Lexicographically earliest sequence such that each subsequence enclosed by a pair of equal values, including the endpoints, has a unique sum.
1, 1, 2, 1, 3, 2, 1, 3, 3, 4, 2, 1, 3, 5, 4, 2, 6, 7, 1, 3, 5, 4, 7, 6, 2, 8, 1, 5, 6, 9, 9, 3, 1, 10, 2, 8, 4, 1, 10, 6, 9, 3, 2, 5, 11, 12, 4, 3, 10, 7, 8, 2, 13, 11, 12, 4, 13, 1, 14, 3, 9, 15, 5, 6, 7, 14, 16, 6, 2, 4, 8, 12, 3, 9, 10, 11, 5, 7, 13, 1, 14
Offset: 1
Keywords
Examples
a(2)=1 creates the pair [a(1), a(2)] = [1, 1], which gives the unique sum of 2. a(4)=1 creates two unique sums: [1,2,1] = sum of 4 and [1,1,2,1] = sum of 5. a(8)=3 creates one unique sum: [3,2,1,3] = sum of 9.
Links
- Michael S. Branicky, Table of n, a(n) for n = 1..10000
Programs
-
Python
from itertools import islice def agen(): # generator of terms s, a = set(), [] while True: an, allnew = 0, False while not allnew: allnew, an, sn = True, an+1, set() for i in range(len(a)): if an == a[i]: t = sum(a[i+1:]) + 2*an if t in s or t in sn: allnew = False; break sn.add(t) yield an; a.append(an); s |= sn print(list(islice(agen(), 81))) # Michael S. Branicky, Feb 14 2024
Extensions
a(16) and beyond from Michael S. Branicky, Feb 14 2024
Comments