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.

A382502 Lexicographically earliest sequence of positive integers such that no two subsequences {a(j), a(j+k), a(j+2k)} and {a(i), a(i+m), a(i+2m)} with different k and m values are the same.

Original entry on oeis.org

1, 1, 1, 2, 3, 1, 2, 3, 4, 5, 6, 7, 8, 1, 9, 2, 3, 4, 5, 6, 1, 10, 7, 8, 11, 9, 12, 7, 10, 5, 13, 12, 14, 4, 6, 15, 16, 11, 17, 8, 18, 2, 3, 9, 5, 18, 1, 19, 14, 5, 15, 4, 20, 21, 13, 12, 22, 23, 24, 2, 21, 11, 25, 8, 26, 16, 20, 3, 27, 17, 12, 28, 29, 30, 31
Offset: 1

Views

Author

Neal Gersh Tolunsky, Mar 29 2025

Keywords

Comments

In other words, each unique subsequence of the form {a(j), a(j+k), a(j+2k)} (j, k >= 1) occurs with only one k value (or index spacing).
Note that a candidate term is sometimes denied because it would create a scenario in which a future term is inevitably the third term in two identical subsequences with different k values. See example.

Examples

			To find a(4), we first try 1. If we allowed a(4) = 1, then the subsequences at i = 1,3,5 and i = 3,4,5 would be the same since they both begin 1,1 and their final index is i=5. Since these two subsequences have distinct k values, they cannot be the same, so a(4) cannot be 1. a(4) = 2 as this creates only one new subsequence, and does not create a scenario where a future value will necessarily contradict the definition.
		

Crossrefs

Programs

  • Python
    from itertools import count
    def A382502_generator():
        a_list = []
        spacings = {} # spacings[t] is the spacing (k) used by the triple t.
        pairs = {} # pairs[i] is a set of pairs (x,y) such that there exist j and k>0 with a(j)=x, a(j+k)=y, and i=j+2k.
        for n in count():
            for a in count(1):
                ok = True
                spacings_new = {}
                for k in range(1,n//2+1):
                    t = a_list[n-2*k],a_list[n-k],a
                    if t in spacings and k != spacings[t] or t in spacings_new:
                        ok = False
                        break
                    spacings_new[t] = k
                if not ok: continue
                pairs_new = []
                for i,a0 in enumerate(reversed(a_list),n+1):
                    p = (a0,a)
                    if i <= 2*(n-1) and p in pairs[i]:
                        ok = False
                        break
                    pairs_new.append(p)
                if ok: break
            yield a
            a_list.append(a)
            spacings.update(spacings_new)
            if n >= 3: del pairs[n+1]
            for i,p in enumerate(pairs_new[1:],n+2):
                if i <= 2*(n-1): pairs[i].add(p)
                else: pairs[i] = {p} # Pontus von Brömssen, Apr 01 2025

Extensions

More terms from Pontus von Brömssen, Mar 30 2025