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.

Showing 1-3 of 3 results.

A375207 a(1)=1; thereafter a(n) is the smallest k for which the subsequence a(n-k..n-1) has a distinct sequence of first differences from that of any other subsequence of the sequence thus far.

Original entry on oeis.org

1, 1, 2, 2, 3, 4, 3, 2, 3, 3, 4, 5, 6, 4, 2, 3, 3, 4, 5, 6, 7, 5, 6, 4, 4, 3, 3, 3, 3, 4, 4, 5, 6, 7, 7, 4, 2, 3, 4, 4, 5, 5, 5, 4, 4, 5, 4, 4, 4, 5, 5, 6, 7, 8, 9, 8, 5, 3, 4, 5, 6, 5, 6, 4, 4, 5, 4, 5, 5, 5, 5, 5, 5, 6, 6, 7, 8, 9, 10, 10, 6, 2, 3, 3, 4, 5, 6, 7
Offset: 1

Views

Author

Neal Gersh Tolunsky, Oct 16 2024

Keywords

Comments

In other words, a(n) is the length of the shortest subsequence ending at a(n-1) which has unique first differences among all first differences of subsequences of the sequence thus far.

Examples

			a(8)=2 because the length-2 subsequence a(6..7) = 4,3 has the shortest unique first differences (-1) of any other subsequence in the sequence thus far.
a(9)=3 because the length-3 subsequence a(6..8) = 4,3,2 likewise has the shortest unique first differences (-1,-1). No shorter subsequence ending in a(8) with unique first differences exists in the sequence thus far. We cannot have, for example, a(7..8) = 3,2 since we saw a subsequence with the same first differences in the previous example, where a(6..7) = 4,3 has first difference (-1).
		

Crossrefs

Programs

  • Python
    from itertools import count, islice
    def fd(t): return tuple(t[i]-t[i-1] for i in range(1, len(t)))
    def agen(): # generator of terms
        a, R, maxL = [1], set(), 0  # maxL = max length of first diff.'s stored
        for n in count(1):
            yield a[-1]
            for k in range(1, n+1):
                if k > maxL:  # must increase length of first diff.'s stored
                    maxL += 1
                    R.update(fd(a[i:i+maxL]) for i in range(n-maxL))
                if fd(a[-k:]) not in R:
                    break
            an = k
            R.update(fd(a[-i:]) for i in range(1, maxL+1))
            a.append(an)
    print(list(islice(agen(), 90))) # Michael S. Branicky, Oct 16 2024

A376937 a(1)=1; thereafter a(n) is the smallest k for which the subsequence a(n-k..n-1) has a distinct rhyme scheme from that of any other subsequence of the sequence thus far.

Original entry on oeis.org

1, 1, 2, 2, 3, 4, 3, 3, 4, 4, 5, 6, 7, 4, 5, 6, 7, 8, 5, 6, 7, 8, 9, 10, 6, 6, 4, 5, 6, 4, 5, 6, 7, 5, 5, 5, 3, 4, 5, 6, 6, 6, 6, 4, 5, 6, 7, 8, 6, 6, 7, 5, 6, 7, 8, 7, 5, 4, 5, 6, 6, 5, 5, 6, 5, 4, 5, 5, 6, 5, 5, 5, 5, 6, 6, 5, 6, 7, 8, 6, 6, 7, 8, 5, 6, 7, 8, 9, 9
Offset: 1

Views

Author

Neal Gersh Tolunsky, Oct 11 2024

Keywords

Comments

In other words, a(n) is the length of the shortest subsequence ending at a(n-1) which has a unique rhyme scheme among all rhyme schemes of subsequences of the sequence thus far. Alternatively, this is (the length of the longest subsequence ending at a(n-1) whose rhyme scheme has occurred before as that of another subsequence) plus 1.
The rhyme scheme of a subsequence is found by assigning 1 to the first unique value, 2 to the second unique value, 3 to the third, and so on.

Examples

			a(6)=4 because the length-4 subsequence a(2..5) = 1,2,2,3 has the shortest unique rhyme scheme (1,2,2,3 or A,B,B,C,) which does not occur elsewhere as the rhyme scheme of any other subsequence in the sequence thus far. No shorter subsequence ending in a(5) with a unique rhyme scheme exists in the sequence thus far. For example, a(6) cannot be 3 because the length-3 subsequence a(3..5) = 2,2,3 has the same rhyme scheme (1,1,2 or A,A,B) as that of the subsequence a(1..3) = 1,1,2.
		

Crossrefs

Cf. A377079, A375207, A120698 (rhyme schemes), A000110.

Programs

  • Python
    from itertools import count, islice
    def rs(t): # rhyme scheme of t
        s, k, m  = [], 1, dict()
        for e in t:
            if e not in m: m[e] = k; k += 1
            s.append(m[e])
        return tuple(s)
    def agen(): # generator of terms
        a, R, maxL = [1], set(), 0  # maxL = max length of rhyme schemes stored
        for n in count(1):
            yield a[-1]
            for k in range(1, n+1):
                if k > maxL:  # must increase length of rhyme schemes stored
                    maxL += 1
                    R.update(rs(a[i:i+maxL]) for i in range(n-maxL))
                if rs(a[-k:]) not in R:
                    break
            an = k
            R.update(rs(a[-i:]) for i in range(1, maxL+1))
            a.append(an)
    print(list(islice(agen(), 90))) # Michael S. Branicky, Oct 13 2024

A378876 a(1)=1; thereafter a(n) is the smallest k for which the subsequence a(n-k..n-1) has a distinct multiset from that of any other subsequence of the sequence thus far.

Original entry on oeis.org

1, 1, 2, 1, 4, 1, 3, 1, 3, 3, 2, 2, 2, 3, 6, 1, 2, 3, 3, 6, 3, 4, 2, 2, 3, 5, 1, 2, 3, 5, 5, 2, 2, 3, 6, 5, 2, 3, 5, 5, 5, 3, 5, 5, 6, 3, 5, 9, 1, 2, 3, 4, 4, 2, 3, 5, 4, 2, 3, 5, 5, 6, 6, 2, 2, 3, 5, 8, 1, 2, 3, 4, 5, 5, 3, 5, 5, 6, 7, 1, 2, 3, 4, 5, 6, 3, 5, 5
Offset: 1

Views

Author

Neal Gersh Tolunsky, Jan 17 2025

Keywords

Comments

In other words, a(n) is the length of the shortest subsequence ending at a(n-1) which has a unique multiset among all multisets of subsequences of the sequence thus far. Alternatively, this is (the length of the longest subsequence ending at a(n-1) whose multiset has occurred before as that of another subsequence) plus 1.

Examples

			a(15) = 6 because the length-6 subsequence a(9..14) =  3,3,2,2,2,3 has the shortest unique multiset, which does not occur elsewhere as the multiset of any other subsequence in the sequence thus far. No shorter subsequence ending in a(14) with a unique ordinal transform exists in the sequence thus far. For example, a(15) cannot be 5 because the length-5 subsequence a(10..14) = 3,2,2,2,3 has the same multiset as that of the subsequence a(9..13) = 3,3,2,2,2.
		

Crossrefs

Showing 1-3 of 3 results.